float field indexed with clucene, access with solr

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

float field indexed with clucene, access with solr

Jérôme Etévé-2
Hi,
 I have an index which I generated with clucene where there is a float field.
This float field is stored as a simple verbatim character string.
The solr schema doc states that for such float fields:
  <!-- numeric field types that store and index the text
         value verbatim (and hence don't support range queries, since the
         lexicographic ordering isn't equal to the numeric ordering) -->

And for sortable float fields:
 <!-- Numeric field types that manipulate the value into
         a string value that isn't human-readable in its internal form,
         but with a lexicographic ordering the same as the numeric ordering,
         so that range queries work correctly. -->

What does exactly means 'a string value that isn't human-readable in
its internal form' ?
Does that mean that such a field as to be indexed as a binary
representation of the number to allow the use of the sfloat type ?

I noticed that in the FloatField class, the method getSortField is like that:

 public SortField getSortField(SchemaField field,boolean reverse) {
    return new SortField(field.name,SortField.FLOAT, reverse);
  }

It seems to return the right type of SortField.FLOAT adapted to my field.

In SortableFloatField,
  public SortField getSortField(SchemaField field,boolean reverse) {
    return getStringSort(field,reverse);
  }

I'm not sure to understand all of this,

 but what I feel is that since the type 'FloatField' gives that  'new
SortField(field.name,SortField.FLOAT)' , it should suits my verbatim
float data for sorting the query results.

Do I have the right feeling ?

thanks for your help


--
Jerome Eteve.
[hidden email]
http://jerome.eteve.free.fr/
Reply | Threaded
Open this post in threaded view
|

Re: float field indexed with clucene, access with solr

Yonik Seeley-2
On 6/28/07, Jérôme Etévé <[hidden email]> wrote:
> Hi,
>  I have an index which I generated with clucene where there is a float field.
> This float field is stored as a simple verbatim character string.

Then you should be able to use FloatField (normally of type "float" in
the schema).

> The solr schema doc states that for such float fields:
>   <!-- numeric field types that store and index the text
>          value verbatim (and hence don't support range queries, since the
>          lexicographic ordering isn't equal to the numeric ordering) -->
>
> And for sortable float fields:
>  <!-- Numeric field types that manipulate the value into
>          a string value that isn't human-readable in its internal form,
>          but with a lexicographic ordering the same as the numeric ordering,
>          so that range queries work correctly. -->
>
> What does exactly means 'a string value that isn't human-readable in
> its internal form' ?
> Does that mean that such a field as to be indexed as a binary
> representation of the number to allow the use of the sfloat type ?

It's munged binary into a string such that the lucene term ordering
(lexicographic) will match the numeric ordering.

 -Yonik