Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Solr-使用精确字数间隔的接近搜索_Solr_Solrj - Fatal编程技术网

Solr-使用精确字数间隔的接近搜索

Solr-使用精确字数间隔的接近搜索,solr,solrj,Solr,Solrj,我正在windows机器上使用apache-solr-3.6.0。我想搜索两个单词,它们之间有一定数量的单词(不超过这个数字)。 例如: 考虑下面的短语,我想搜索Dasia&Cype,不超过2个单词。 Daisy has exam. Daisy has an exam. Daisy has a math exam. Daisy has a difficult math exam. 我寻找这样的东西,我试着用术语接近 http://localhost:8983/solr/select/?q="D

我正在windows机器上使用apache-solr-3.6.0。我想搜索两个单词,它们之间有一定数量的单词(不超过这个数字)。 例如: 考虑下面的短语,我想搜索Dasia&Cype,不超过2个单词。

Daisy has exam.
Daisy has an exam.
Daisy has a math exam.
Daisy has a difficult math exam.
我寻找这样的东西,我试着用术语接近

http://localhost:8983/solr/select/?q="Daisy exam"~2&version=2.2&start=0&rows=10&indent=on&debugQuery=true
我需要的结果应该是短语:
Daisy有一个考试。
但根据上述标准,结果是最后3个短语


那么,有没有办法用精确的字数分开呢?

在这里查看相关问题:

当你说“相隔不超过两个单词”时,你应该让第一个和第二个短语匹配。然后您的查询将是
“Daisy-exam”~1
,它将匹配Daisy-exam和它们之间的插入(即onechange:changes
exam
位置从2变为3)


为了防止匹配结果中出现“雏菊检查”,您可以向查询中添加
-“雏菊检查”
。或者,您可以在查询字符串参数中添加
fq=-“Daisy考试”

谢谢您的回复,但我希望结果是这样的短语:
Daisy有考试。
使用
~1
无法获得该结果。即使使用
~2
也不会让我得到准确的结果,就像有一句话:
黛西考试。
它会被包括在内,这不是我想要的。有什么想法吗?我认为这在Solr中是不可能的,因为
q~x
匹配更改小于或等于x的文档。顺便说一句,你可以直接排除
fq
中的“雏菊检查”,如果它解决了这个问题。