lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Using Solr to perform range queries in Dspace
Date Wed, 28 Jul 2010 21:50:11 GMT

: I'm trying to use dspace to search across a range of index created and stored
: using Dsindexer.java class. I have seen where Solr can be use to perform

I've never headr of Dsindexer.java but since this is hte first result 
google returns...

http://scm.dspace.org/trac/dspace/browser/trunk/dspace/src/org/dspace/search/DSIndexer.java?rev=970

...i'm going to assume that's what you are talking about.

: numerical range queries using either TrieIntField,
: TrieDoubleField,TrieLongField, etc.. classes defined in Solr's api or 
: SortableIntField.java, SortableLongField,SortableDoubleField.java. I would
: like to know how to implement these classes in Dspace so that I can be able
: to perform numerical range queries. Any help would be greatly apprciated.

i *think* what you are asking is how to use Solr to search the numeric 
fields in an existing Lucene index (created by the above mentioned java 
code) -- but i may be wrong (your choice of wording "implement these 
classes in Dspace" is very perplexing to me).

If i'm understanding correctly, then the key to the issue is all in how 
the numeric values are indexed as lucene "Fields" in your existing code -- 
but in the copy of DSIndexer.java i found, there are no numeric fields, 
just Text fields.  If you are indexing the numeric values as simple 
strings, then in Solr you would want to refer to them using hte legacy 
"IntField", "FloatField", etc... these assume simple string 
representations, and will sort properly using the numeric FieldCache -- 
BUT! -- range queries won't work.  Range queries require that the indexed 
terms be a "logical" ordering which isn't true for simple string 
representations of numbers ("100" is lexigraphically before "2").

If i actually have your question backwards -- if what you are asiking is 
how to modify the DSIndexer.java class to index fields in the same way as 
TrieDoubleField,TrieLongField,SortableIntField, etc... then the 
answer is much simpler: all FieldType's in Solr implement toInternal and 
toExternal methods ... the toInternal is what you need to call to "encode" 
your simple numeric values into the format to be indexed -- toExternal (or 
toObject) is how you cna get the original value back out.

For the "Trie" fields, these actually just use some utilities in Lucnee, 
so you could look at the code and use the same utilities w/o ever needing 
any Solr source code.

If i've completley missunderstood your question, plese post a followup 
explaining in more detail what it is you are trying to accomplish.

-Hoss


Mime
View raw message