Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.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
Search Lucene 3.6+;使用撇号搜索术语的问题_Search_Indexing_Lucene - Fatal编程技术网

Search Lucene 3.6+;使用撇号搜索术语的问题

Search Lucene 3.6+;使用撇号搜索术语的问题,search,indexing,lucene,Search,Indexing,Lucene,我们在代码中使用Lucene v3.6。我们首先索引数据,然后使用Lucene搜索来搜索术语。使用Luke,我已经确认,当我们索引一个术语,比如Hashimoto's时,我假设它会被撇号索引(因为当我从获得的结果中搜索Hashimoto时,我可以确认相应的字段值包含了作为Hashimoto's的撇号。然而,当我搜索Hashimoto's时(甚至在Luke中)我没有得到该领域的任何结果 +names.name:hashimoto (works and returns multiple result

我们在代码中使用Lucene v3.6。我们首先索引数据,然后使用Lucene搜索来搜索术语。使用Luke,我已经确认,当我们索引一个术语,比如Hashimoto's时,我假设它会被撇号索引(因为当我从获得的结果中搜索Hashimoto时,我可以确认相应的字段值包含了作为Hashimoto's的撇号。然而,当我搜索Hashimoto's时(甚至在Luke中)我没有得到该领域的任何结果

+names.name:hashimoto (works and returns multiple results some which have Hashimoto's as a term)
+names.name:hashimoto's (does not work - no results)

在这两种情况下,我都在使用StandardAnalyzer,据我所知,StandardAnalyzer应该可以毫无问题地处理撇号。

看起来您使用的是一个未被分析的查询。一般来说,查询时间分析是由QueryParser处理的。如果您没有使用,您的查询将不会被分析。如果您正在手动构建queries(
TermQuery
,例如),假设您自己处理过任何与分析相关的问题,因此将按原样搜索该术语。

在我的代码中,我使用StandardAnalyzer。我使用tokenStream方法从StandardAnalyzer中取回标记,并使用它们来构建查询。从一些研究中,例如,我了解,撇号应该得到支持ely使用StandardAnalyzer。但似乎不是这样。正如我提到的,在使用Luke搜索我的索引的情况下,选择StandardAnalyzer也没有帮助。