How to query for integers, float in lucene and how to store (NumericComparator)?

The bigger question is, will solr even support this? I know that I saw how lucene can do this, and solr is built on lucene.

I saw an example somewhere using google, but cannot find it again, and the example was not complete, because I do not think it had a part of the request for how I write my request statement for lucene. I remember seeing NumericField, and there is this NumericComparator.

Basically, I am trying to create a noSQL orm solution that offers indexing (on github) (although the client decides how many indexes are for the table and partitioning methodology, you add entites to the index and delete them yourself and you can use namedQueries, although you should first get index by name before the query, since one table can have millions of indexes). The two main things I want to achieve are that it all works with nosql in-memory flash and an in-memory index (lucene RAMDirectory), and then I want to switch them to cassandra and SOLR.

I basically need

  • figure out how to store integers, floats, etc.
  • figure out how to write a lucene query when the goals are strings, float, ints, etc.

, , https://github.com/deanhiller/nosqlORM/blob/master/input/javasrc/com/alvazan/orm/layer3/spi/index/inmemory/MemoryIndexWriter.java

172 , , , , ints.

: SOLR int vs. string? ( , 0 ints, longs .., ints ).

IF SOLR , lucene, ?

, NoSqlEntityManager.getIndex(Class clazz, String indexPartitionName) ( , ). https://github.com/deanhiller/nosqlORM/blob/master/input/javasrc/com/alvazan/orm/api/Index.java

,

+5
2

SOLR schema.xml:

<!--
      Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types.
    -->
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
<!--
     Numeric field types that index each value at various levels of precision
     to accelerate range queries when the number of values between the range
     endpoints is large. See the javadoc for NumericRangeQuery for internal
     implementation details.

     Smaller precisionStep values (specified in bits) will lead to more tokens
     indexed per value, slightly larger index size, and faster range queries.
     A precisionStep of 0 disables indexing at different precision levels.
    -->
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>

, , (, myIntField:1234), " ", (myIntField:[1200 TO 1300]), ..

+8

, org.apache.lucene.document.NumericField. set, int, log, float double. (, bool, datetime) , int long type.

, lucene, : FloatField, IntField, LongField DoubleField. . http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/

+2

All Articles