掲示板

Liferay Lucene BooleanQuery.addTerms() question

7年前 に Paul P によって更新されました。

Liferay Lucene BooleanQuery.addTerms() question

New Member 投稿: 19 参加年月日: 15/08/05 最新の投稿
Hi. Faced a problem.
When using BooleanQuery.addTerms(String[] fields, String value, boolean like) method every analyzed token of the string(if it contains several words) is placed in the constructed query with BooleanClauseOccur.SHOULD. Is there any functionality to construct the query using BooleanClauseOccur.MUST instead. (I need something like (+(field1:*val1*) +(field2:*val2)), not (field1:*val1* field2:*val2))
thumbnail
7年前 に Sushil Patidar によって更新されました。

RE: Liferay Lucene BooleanQuery.addTerms() question

Expert 投稿: 467 参加年月日: 11/10/31 最新の投稿
Hi,

I think you should combine subqueries as follows

      BooleanQuery mainQuery= BooleanQueryFactoryUtil.create(context);
	mainQuery.add(query1, BooleanClauseOccur.MUST);
	mainQuery.add(query2, BooleanClauseOccur.MUST);
7年前 に Paul P によって更新されました。

RE: Liferay Lucene BooleanQuery.addTerms() question

New Member 投稿: 19 参加年月日: 15/08/05 最新の投稿
This is the way I've resolved this issue. But what if I have 25 fields? I can't understand why there is no sort of overloaded version of the bulk method...