i have been searching through documents in marqo by passing a query as an argument to the .search()
method but this returns a list of documents from best to least match. i will like to pass a keyword from the document and i should only get the documents that have those keyword
this is how i currently search:
results = mq.index("my-index").search(
q="keyword"
)
this is how the output look like:
{'hits': [{'Description': "document_1_description",
'Title': 'document_1_title',
'_highlights': best_match,
'_id': 'd65454db-680c-4f77-8c82-f9aaea66efa1',
'_score': 0.5562359},
{'Description': 'document_2_description',
'Title': 'document_2_title',
'_highlights': best_match},
'_id': 'article_591',
'_score': 0.5176503}],
'limit': 10,
'processingTimeMs': 107,
'query': 'keyword'}
All you have to do is pass another keyword argument
search_method="LEXICAL"
to the.search()
methodhere is how your code should look like: