You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Sanket Paranjape <sa...@gmail.com> on 2013/08/23 16:17:10 UTC

Index Field with IntField and RangeQuery with LongRange

I created a index with IntField but while querying I create a 
NumericRangeQuery.newLongRange(...) (by mistake ofcourse).

I was not getting any products and I had a hard time finding the issue.

Should this be thrown as a exception so that user knows what the issue 
is. Something like type mismatch may be.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


RE: Index Field with IntField and RangeQuery with LongRange

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi Sanket,

this was already mentioned several times: In fact, Lucene does not have a schema, so it does not know the field type of indexed fields from the IndexReader (that’s different for stored fields). So we cannot throw an exception, because the index format has no information about the data type. NumericRangeQuery can just create a range of terms using the type from the user. The same "unknown" information is the precisionStep, so you must use the same precisionStep for indexing and searching. The same issue: You must use same (or compatible) analyzers for indexing and search. So Numeric fields are not different than any other field type.

The Lucene developers discussed several times about that and the final outcome was *not* to add a schema and leave this in place for higher level tools like Apache Solr or ElasticSearch.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Sanket Paranjape [mailto:sanket.paranjape.mailinglist@gmail.com]
> Sent: Friday, August 23, 2013 4:17 PM
> To: java-user@lucene.apache.org
> Subject: Index Field with IntField and RangeQuery with LongRange
> 
> I created a index with IntField but while querying I create a
> NumericRangeQuery.newLongRange(...) (by mistake ofcourse).
> 
> I was not getting any products and I had a hard time finding the issue.
> 
> Should this be thrown as a exception so that user knows what the issue is.
> Something like type mismatch may be.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org