You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "benny@bkern.de" <be...@bkern.de> on 2013/05/08 10:37:00 UTC

Indexing Point Number

 Hi,
 how can I indexing numbers with decimal point.
 For example:
 5,50
 109,90

 I want to sort the numbers.

 Thanks

 


Re: Indexing Point Number

Posted by Jack Krupansky <ja...@basetechnology.com>.
I presume you meant to substitute the pattern and replacement for this case:

<processor class="solr.RegexReplaceProcessorFactory">
   <str name="fieldName">content</str>
   <str name="fieldName">title</str>
   <str name="pattern">,</str>
   <str name="replacement">.</str>
</processor>

-- Jack Krupansky

-----Original Message----- 
From: Upayavira 
Sent: Wednesday, May 08, 2013 6:32 AM 
To: solr-user@lucene.apache.org 
Subject: Re: Indexing Point Number 

You could use a RegexReplaceProcessor in an update processor chain. From
the Javadoc:

<processor class="solr.RegexReplaceProcessorFactory">
   <str name="fieldName">content</str>
   <str name="fieldName">title</str>
   <str name="pattern">\s+</str>
   <str name="replacement"> </str>
</processor>

This could replace the comma with a dot before it gets to be indexed.

Upayavira

On Wed, May 8, 2013, at 10:28 AM, Gora Mohanty wrote:
> On 8 May 2013 14:48, benny@bkern.de <be...@bkern.de> wrote:
> > I will index for example:
> > <field name="price">19,95</field>
> > <field name="price">25,45</field>
> >
> > I can only float with numbers with dots indexing.
> 
> I don't think that it is currently possible to change the decimal
> separator. You should replace ',' with '.' during indexing, and
> searching which should be fairly easy.
> 
> Regards,
> Gora

Re: Indexing Point Number

Posted by Upayavira <uv...@odoko.co.uk>.
You could use a RegexReplaceProcessor in an update processor chain. From
the Javadoc:

 <processor class="solr.RegexReplaceProcessorFactory">
   <str name="fieldName">content</str>
   <str name="fieldName">title</str>
   <str name="pattern">\s+</str>
   <str name="replacement"> </str>
 </processor>

This could replace the comma with a dot before it gets to be indexed.

Upayavira

On Wed, May 8, 2013, at 10:28 AM, Gora Mohanty wrote:
> On 8 May 2013 14:48, benny@bkern.de <be...@bkern.de> wrote:
> > I will index for example:
> > <field name="price">19,95</field>
> > <field name="price">25,45</field>
> >
> > I can only float with numbers with dots indexing.
> 
> I don't think that it is currently possible to change the decimal
> separator. You should replace ',' with '.' during indexing, and
> searching which should be fairly easy.
> 
> Regards,
> Gora

Re: Indexing Point Number

Posted by Gora Mohanty <go...@mimirtech.com>.
On 8 May 2013 14:48, benny@bkern.de <be...@bkern.de> wrote:
> I will index for example:
> <field name="price">19,95</field>
> <field name="price">25,45</field>
>
> I can only float with numbers with dots indexing.

I don't think that it is currently possible to change the decimal
separator. You should replace ',' with '.' during indexing, and
searching which should be fairly easy.

Regards,
Gora

Re: Indexing Point Number

Posted by "benny@bkern.de" <be...@bkern.de>.
 I will index for example:
 <field name="price">19,95</field>
 <field name="price">25,45</field>

 I can only float with numbers with dots indexing.

 Thanks

 Am Mittwoch, den 08.05.2013, 10:52 +0200 schrieb Rafał Kuć 
 <r....@solr.pl>:
> Hello!
>
> Use a float field type in your schema.xml file, for example like 
> this:
> <fieldType name="float" class="solr.TrieFloatField" precisionStep="0"
> positionIncrementGap="0"/>
>
> Define a field using this type:
> <field name="price"  type="float" indexed="true" stored="true"/>
>
> You'll be able to index data like this:
> <field name="price">19.95</field>
>
> --
> Regards,
>  Rafał Kuć
>  Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - 
> ElasticSearch
>
>>  Hi,
>>  how can I indexing numbers with decimal point.
>>  For example:
>>  5,50
>>  109,90
>
>>  I want to sort the numbers.
>
>>  Thanks
>
>>

Re: Indexing Point Number

Posted by Rafał Kuć <r....@solr.pl>.
Hello!

Use a float field type in your schema.xml file, for example like this:
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>

Define a field using this type:
<field name="price"  type="float" indexed="true" stored="true"/>

You'll be able to index data like this:
<field name="price">19.95</field>

-- 
Regards,
 Rafał Kuć
 Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

>  Hi,
>  how can I indexing numbers with decimal point.
>  For example:
>  5,50
>  109,90

>  I want to sort the numbers.

>  Thanks

>