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中的字段交叉搜索_Search_Lucene_Full Text Search - Fatal编程技术网

Search lucene中的字段交叉搜索

Search lucene中的字段交叉搜索,search,lucene,full-text-search,Search,Lucene,Full Text Search,你好: 我有两份文件: title body Lucene In Action A high-performance, full-featured text search engine library. Lucene Practice Use lucene in your application 现在,我使用 然后我得到两个点击: “Lucene在行动”和“Lucene实践” 但是,我不希望搜索结果中出现

你好: 我有两份文件:

title                       body
Lucene In Action            A high-performance, full-featured text search engine library.
Lucene Practice             Use lucene in your application
现在,我使用

然后我得到两个点击: “Lucene在行动”和“Lucene实践”

但是,我不希望搜索结果中出现“Lucene practice”

也就是说,我只希望能够返回拥有我所有搜索词的文档,“lucene parctice”不包含“performance”一词,因此不应返回


有什么想法吗?

Lucene无法在各个领域进行匹配。也就是说,对于查询
“ab”
,它将与
标题中的
“a”
正文中的
“b”
不匹配。为此,您需要创建另一个字段,例如,
all_text
,该字段的标题和正文都已索引


另外,当您搜索
“lucene性能”
时,我想您要查找的文档既有术语-
lucene
又有
performance
。默认情况下,布尔运算符为
。您需要将默认运算符指定为
,以匹配查询中的所有术语。(否则,在本例中,“lucene性能”查询将开始返回有关数据库性能的匹配项。)

对于英文字符搜索,您是对的。我正在寻找一些解决汉字书写的方法。无论如何,谢谢你。
private String[] f = { "title", "body"};
private Occur[] should = { Occur.SHOULD, Occur.SHOULD};
Query q = MultiFieldQueryParser.parse(Version.LUCENE_29, "lucene performance", f, should,new IKAnalyzer());