【发布时间】:2021-09-30 13:06:21
【问题描述】:
环境 - solr-8.9.0
为了在 apache solr 中对 csv 文件的“名称”列进行模糊搜索(模糊搜索“alaistiar~”),我发出以下查询
http://localhost:8983/solr/bigboxstore/select?indent=on&q=name:'alaistiar~'&wt=json
在apache solr中对csv文件的“name”列进行模糊搜索(模糊搜索'shanka~')
http://localhost:8983/solr/bigboxstore/select?indent=on&q=name:'shanka~'&wt=json
我可以将上述两个查询合并到一个单独的查询中并找出文档吗?
我的第一个 http 请求是在 name 列上对 value alaistiar~ 进行模糊搜索并给出一些分值,第二个 http 请求是针对 shanka~。当我将两者与“或”运算符结合使用时,它们的行为是否与单个请求相同。实际上,我的目的是我不想为多个名称调用多个 http 请求,而且我希望输出中的模糊搜索名称表明该文档适用于name alaistiar~ 这个文件是 name shanka~
我已经加载了一个包含 4 列(大小为 5GB。)的 csv 文件,其中包含 1 亿条记录。 .csv 文件具有以下列名称 -
'name', 'father_name', 'date_of_passing','admission_number'
我已经在“名称”列上创建了索引。为此,我在托管模式(solr-8.9.0,jdk-11.0.12)上执行了以下 curl 请求
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field":{"name":"name","type":"text_general","stored":true,"indexed":true }}' http://localhost:8983/solr/bigboxstore/schema
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field":{"name":"father_name","type":"text_general","stored":true,"indexed":false }}' http://localhost:8983/solr/bigboxstore/schema
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field":{"name":"date_of_passing","type":"pdate","stored":true,"indexed":false }}' http://localhost:8983/solr/bigboxstore/schema
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field":{"name":"admission_number","type":"text_general","stored":true,"indexed":false }}' http://localhost:8983/solr/bigboxstore/schema
如上所述,这是在 1 列(仅在名称上)创建索引的正确方法吗?
现在我有 100 万个名字的列表。在每个名称上,我必须对已加载的数据进行模糊搜索(列:名称)。在输出中,对于每个名称,我必须返回 java 对象列表,包括 .csv 文件的所有 4 列。
注意-在输出中,我还必须包含作为输入提供的名称(在 where 子句中)。 对于每个名称,我都进行如下模糊搜索:
http://localhost:8983/solr/bigboxstore/select?indent=on&q=name:'alaistiar~'&wt=json.
为此,我必须执行 1 百万个 http 请求,这是我不想要的。我可以在单个 http 请求中执行 100 万个 http 请求,而不是执行?
我知道'OR 运算符不会解决我的问题,因为我无法根据作为输入传递的名称对输出文档进行分组。
【问题讨论】:
标签: solr fuzzy-search