Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to perform a keyword search in marqo

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

{'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'}

>Solution :

was also facing the same problem bro but all you have to do is pass another keyword argument search_method="LEXICAL" to the .search() method

here is how your code should look like:

result =  mq.index("my-index").search(q='keyword', search_method="LEXICAL")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading