搜索的交叉点(在差异字段中) - Lucene

时间:2016-11-24 15:03:30

标签: search lucene field intersection

我在Lucene 6.2.1中尝试过:

我有不同的字段[INFO] --- gatling-maven-plugin:2.2.1:execute (default-cli) @ portal-performance --- 15:37:40.834 [main][WARN ][ZincCompiler.scala:142] i.g.c.ZincCompiler$ - Pruning sources from previous analysis, due to incompatible CompileSetup. 15:37:49.115 [main][ERROR][ZincCompiler.scala:156] i.g.c.ZincCompiler$ - Compilation crashed java.lang.StackOverflowError: null at scala.tools.nsc.typechecker.Contexts$Context.make(Contexts.scala:467) at scala.tools.nsc.typechecker.Contexts$Context.makeSilent(Contexts.scala:515) at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:675) at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4524) at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4580) at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5343) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5360) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:698) at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5396) ABCD,我为每个字段设置了不同的E

然后我想要一个交集。当结果无处不在时显示它。

有人告诉我用searchquery试试。所以这是我的方法:

Booleanquery

为什么不工作?可能是什么错?它总是没有返回结果:(

1 个答案:

答案 0 :(得分:0)

当我看到你的代码时,似乎你没有获得BooleanQuery的实例。从lucene 5开始,布尔查询的API已经改变。请尝试以下方法:

QueryParser parser1 = new QueryParser("A", analyzer);// i have 5 different QueryParser
Query qPersonen = parser1.parse("searchstring"); // i have also 5 Queries
BooleanQuery.Builder bq = new BooleanQuery.Builder();
bq.add(new BooleanClause(aPersonen, BooleanClause.Occur.MUST));

希望这对您有用:)