lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michel, Jerome" <>
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:
                at org.apache.lucene.document.RangeFieldQuery.checkFieldInfo(
                at org.apache.lucene.document.RangeFieldQuery.access$400(
                at org.apache.lucene.document.RangeFieldQuery$1.scorer(

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

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!



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