【问题标题】:How to perform a keyword search in marqo如何在 marqo 中执行关键字搜索
【发布时间】:2022-11-12 07:05:36
【问题描述】:

我一直在通过将查询作为参数传递给.search() 方法来搜索marqo 中的文档,但这会返回从最佳匹配到最不匹配的文档列表。我想从文档中传递一个关键字,我应该只获取具有这些关键字的文档

这就是我目前搜索的方式:

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

【问题讨论】:

    标签: python python-3.x machine-learning


    【解决方案1】:

    兄弟也面临同样的问题,但您只需将另一个关键字参数search_method="LEXICAL" 传递给.search() 方法

    这是您的代码的外观:

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

    【讨论】:

      猜你喜欢
      • 2022-11-14
      • 1970-01-01
      • 1970-01-01
      • 2011-07-10
      • 2010-10-07
      • 2021-07-26
      • 2017-02-18
      • 1970-01-01
      • 2014-12-08
      相关资源
      最近更新 更多