开发者

lucene BooleanQuery equals/in

I am searching in lucene with a "equals" operator implemented like:

return new TermQuery(new Term(getName(), getValue()));

for a vale like: customerID:YADA-UT-08ec5de9-8813-4361-be88-55695ddfaa00

This is working.

BUT, if i use an "in" operator implemented with a BooleanQuery like;

final BooleanQuery booleanQuery = new BooleanQuery();
for (final String aValue : value) {
    booleanQuery.add(new TermQuery(new Term(getName(), aValue)), BooleanClause.Occur.SHOULD);
}

it will not find any customer with YADA-UT-08ec5de9-8813-4361-be88-55695ddfaa00

After a lot of tests i am assuming t开发者_运维问答hat the length of 'YADA-UT-08ec5de9-8813-4361-be88-55695ddfaa00' or dashes can be the problem. (i use token to keep it in db) when using with BooleanQuery.

Any clue ?

EDIT: What is strange is that: - this is working with "in" (Boolean query): 25c20c21-bd88-4a6d-aa02-209b5fb6fb11 - this is not working with it: YADA-UT-08ec5de9-8813-4361-be88-55695ddfaa00

Solution Found: the lucene words were indexed as lower case :)


Strange solution for me but...that's it:)

the lucene words were indexed as lower case :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜