lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hemant Kumar <>
Subject TermQuery or PhraseQuery not working after switching from Lucene 3.6 to 4.6
Date Mon, 03 Nov 2014 15:14:56 GMT

I'm currently migrating from the really old version 3.6 to 4.6. I deleted my old index and
re-indexed everything after migration the whole code base. Now everything works fine except
one thing: My search doesn't return any results as soon as I add some TermQuery or PhraseQuery
to an analyzed field.

I must say that we usually filter by several options - for unknown reasons, these are not
added by filters, but rather by adding BooleanQuery-s to the normal search query. Since this
works fine, and I get the correct results, the index must be okay in general.

Whenever I add some fulltext queries, or even only send a single TermQuery without any additional
filters, I don't get any results.

I debugged into the code and found out that in<AtomicReaderContext>
leaves, Weight weight, Collector collector), the scorer is null. The reason for that is that
TermQuery$TermWeight only has null within termStates.states.

Because of that, TermWeight.getTermsEnum returns null - TermState state = this.termStates.get(context.ord);
already returns null.

The IndexSearcher then silently skips this query and doesn't even look in the index.

My own code is similar to that of the usual examples, and I don't use any specific boosting,
filters, or any.

Any help is appreciated.



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message