lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michel, Jerome" <jmic...@forcepoint.com>
Subject NPE while using InteresctQuery of IntRangeField
Date Fri, 09 Dec 2016 14:09:29 GMT
Hi all,

I am trying to use the IntRangeField Field of Lucene, because I found it very usefull for
me in my use-case.
So at indexing time, I use the IntRangeField(String name, final int[] min, final int[] max)
constructor with only 1 dimension on min and max and the name of my field.
At searching time, I create my own BooleanQuery in which I add an newIntersectsQuery(String
field, final int[] min, final int[] max).

It's not a field I use in all documents, but 10-15% of my documents contains it I think.
The problem is that using that, when searching, I have an NPE with the current Stacktrace:
java.lang.NullPointerException
                at org.apache.lucene.document.RangeFieldQuery.checkFieldInfo(RangeFieldQuery.java:101)
                at org.apache.lucene.document.RangeFieldQuery.access$400(RangeFieldQuery.java:43)
                at org.apache.lucene.document.RangeFieldQuery$1.scorer(RangeFieldQuery.java:169)
                at org.apache.lucene.search.BooleanWeight.scorer(BooleanWeight.java:389)
                at org.apache.lucene.search.BooleanWeight.scorer(BooleanWeight.java:389)
                at org.apache.lucene.search.Weight.bulkScorer(Weight.java:135)
                at org.apache.lucene.search.BooleanWeight.bulkScorer(BooleanWeight.java:370)
                at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:666)
                at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:473)
                ...

As I inspect the code, I found that it's the scoring on Range which was throwing that. In
RangeFieldQuery, I found (Line 165):
FieldInfo fieldInfo = reader.getFieldInfos().fieldInfo(field);
if (fieldInfo == null) {
   // no docs in this segment indexed this field
}
checkFieldInfo(fieldInfo);

In my case, I may have no Document with this field in my segment (which can be true because
I don't have much Documents with this field) as the comment said, but the code tries to check
the info afterwards on a null fieldInfo.

Did I missed something on my part of the code to solve this issue?
I would be grateful for any help!

Regards,

Jerome

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