Re: IllegalStateException in SpanTermQuery

2013-08-14 Thread Michael McCandless
OK I see why your test in 3.5 was passing: if you just run SpanTermQuery alone, the hit count will be correct, because it never needs to access positions (I suspect?). Ie, a SpanTermQuery alone is like running TermQuery. It's when SpanTermQuery is used inside other SpanQuerys that positions will

Re: IllegalStateException in SpanTermQuery

2013-08-14 Thread Erick Erickson
As Mike said, this is an intended change. The test passed in 3.5 because there was no check if Span queries were working on a field that supported them. In 4.x this is checked and an error is thrown. Best Erick On Wed, Aug 14, 2013 at 12:22 AM, Yonghui Zhao wrote: > In our old code, we create t

Re: IllegalStateException in SpanTermQuery

2013-08-13 Thread Yonghui Zhao
In our old code, we create the filed like this. Field metaField = new Field(name,strVal,fldDef.store, Index.NOT_ANALYZED_NO_NORMS); metaField.setOmitNorms(true); *metaField.setIndexOptions(IndexOptions.DOCS_ONLY);* luceneDoc.add(metaFi

Re: IllegalStateException in SpanTermQuery

2013-08-13 Thread Michael McCandless
All span queries require positions to work; older Lucene released failed to catch you if you tried to use a span query on a field that did not index positions, but now Lucene 4.x does catch you (this is an improvement). You should double check your unit test: it really should not have been passing

IllegalStateException in SpanTermQuery

2013-08-13 Thread Yonghui Zhao
One of my UT is passed In lucene 3.5, but it is failed in lucene4.3. The exception is: IllegalStateException("field \"" + term.field() + "\" was indexed without position data; cannot run SpanTermQuery (term=" + term.text() + ")"); After I change index option of the field from DOCS_ONLY to DOCS_A