我一直在通過將查詢作為引數傳遞給方法來搜索marqo.search()中的檔案,但這會回傳從最佳匹配到最不匹配的檔案串列。我想從檔案中傳遞一個關鍵字,我應該只獲取具有這些關鍵字的檔案
這就是我目前搜索的方式:
results = mq.index("my-index").search(
q="keyword"
)
這是輸出的樣子:
{'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'}
uj5u.com熱心網友回復:
您所要做的就是將另一個關鍵字引數傳遞search_method="LEXICAL"給該.search()方法
這是您的代碼的外觀:
result = mq.index("my-index").search(q='keyword', search_method="LEXICAL")
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/533068.html
標籤:Python机器学习马可
上一篇:使用來自Pytorch的Conv2d的卷積預期結果不匹配?
下一篇:對分類任務進行投票
