拆分查询还是使用原始查询在矢量数据库中搜索?

问题描述 投票:0回答:0

例如我有一个查询“纽约的中餐馆”

我希望查询结果中出现更多不同的单词,越多越好

  1. 拆分查询 ["chinese", "resturant", "new york"],获取它们的嵌入,总共 3 个,并编写算法以实现与 es 中的
    bool should
    查询类似的效果。
{
    "query": {
        "bool": {
            "should": [
                {
                    "match_phrase": {
                        "content": {
                            "query": "chinese"
                        }
                    }
                },
                {
                    "match_phrase": {
                        "content": {
                            "query": "resturant"
                        }
                    }
                },
                {
                    "match_phrase": {
                        "content": {
                            "query": "new york"
                        }
                    }
                }
            ],
            "minimum_should_match": "2<70%"
        }
    },
    "size": 20
}
  1. 只需使用原始字符串“chineseresturant in new york”,获取其嵌入,在矢量数据库中搜索

哪个更好?

embedding information-retrieval
© www.soinside.com 2019 - 2024. All rights reserved.