Working suggester ingester
This commit is contained in:
@@ -80,8 +80,7 @@ def process_file(file_name: str, field_name: str, array_file: str = None) -> int
|
|||||||
|
|
||||||
if array_file and array_file in data and data[array_file]:
|
if array_file and array_file in data and data[array_file]:
|
||||||
for key in data[array_file]:
|
for key in data[array_file]:
|
||||||
if key != data[field_name]: # => Absolutely don't work for album, and block a scoring for artists
|
input.extend(get_tokens(key))
|
||||||
input.extend(get_tokens(key))
|
|
||||||
|
|
||||||
# TODO Input have the same value several times ==> use to process a score
|
# TODO Input have the same value several times ==> use to process a score
|
||||||
post_document(name=data[field_name], input=input, field_name=field_name.lower())
|
post_document(name=data[field_name], input=input, field_name=field_name.lower())
|
||||||
@@ -97,7 +96,7 @@ def process_file(file_name: str, field_name: str, array_file: str = None) -> int
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Using readlines()
|
# Using readlines()
|
||||||
count = 0
|
count = 0
|
||||||
count += process_file('/home/budd/workspace/iTunes/es-albums.json', 'Album', 'Artist')
|
count += process_file('/home/budd/workspace/iTunes/es-albums.json', 'Album')
|
||||||
print('Created documents: ' + str(count))
|
print('Created documents: ' + str(count))
|
||||||
count += process_file('/home/budd/workspace/iTunes/es-artists.json', 'Artist', 'Album Artist')
|
count += process_file('/home/budd/workspace/iTunes/es-artists.json', 'Artist', 'Album Artist')
|
||||||
print('Created documents: ' + str(count))
|
print('Created documents: ' + str(count))
|
||||||
|
|||||||
Reference in New Issue
Block a user