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 Sebastian F <qb...@yahoo.com> on 2010/03/09 18:20:19 UTC

Filter to cut out all zeors?

Hey there,

I'm trying to figure out the best way to cut out all zeros of an input string like "01.10." or "022.300"...
Is there such a filter in Solr or anything similar that I can adapt to do the task?

Thanks for any help



      

Re: Filter to cut out all zeors?

Posted by Norberto Meijome <nu...@gmail.com>.
won't this replace *all* 0s ? ie, 1024 will become 124 ?
_________________________
{Beto|Norberto|Numard} Meijome

"The only people that never change are the stupid and the dead"
 Jorge Luis Borges.

I speak for myself, not my employer. Contents may be hot. Slippery when wet.
Reading disclaimers makes you go blind. Writing them is worse. You have been
Warned.


On 11 March 2010 03:24, Sebastian F <qb...@yahoo.com> wrote:

> yes, thank you. That was exactly what I was looking for! Great help!
>
>
>
>
> ________________________________
> From: Ahmet Arslan <io...@yahoo.com>
> To: solr-user@lucene.apache.org
> Sent: Tue, March 9, 2010 7:26:46 PM
> Subject: Re: Filter to cut out all zeors?
>
> > I'm trying to figure out the best way to cut out all zeros
> > of an input string like "01.10." or "022.300"...
> > Is there such a filter in Solr or anything similar that I
> > can adapt to do the task?
>
> With solr.MappingCharFilterFactory[1] you can replace all zeros with ""
> before tokenizer.
>
> <charFilter class="solr.MappingCharFilterFactory" mapping="mapping.txt"/>
>
> SolrHome/conf/mapping.txt file will contain this line:
>
> "0" => ""
>
> So that "01.10." will become "1.1." and  "022.300" will become "22.3" Is
> that you want?
>
> [1]
> http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.MappingCharFilterFactory
>
>
>
>

Re: Filter to cut out all zeors?

Posted by Sebastian F <qb...@yahoo.com>.
yes, thank you. That was exactly what I was looking for! Great help!




________________________________
From: Ahmet Arslan <io...@yahoo.com>
To: solr-user@lucene.apache.org
Sent: Tue, March 9, 2010 7:26:46 PM
Subject: Re: Filter to cut out all zeors?

> I'm trying to figure out the best way to cut out all zeros
> of an input string like "01.10." or "022.300"...
> Is there such a filter in Solr or anything similar that I
> can adapt to do the task?

With solr.MappingCharFilterFactory[1] you can replace all zeros with "" before tokenizer. 

<charFilter class="solr.MappingCharFilterFactory" mapping="mapping.txt"/>

SolrHome/conf/mapping.txt file will contain this line:

"0" => ""

So that "01.10." will become "1.1." and  "022.300" will become "22.3" Is that you want?

[1]http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.MappingCharFilterFactory 


      

Re: Filter to cut out all zeors?

Posted by Ahmet Arslan <io...@yahoo.com>.
> I'm trying to figure out the best way to cut out all zeros
> of an input string like "01.10." or "022.300"...
> Is there such a filter in Solr or anything similar that I
> can adapt to do the task?

With solr.MappingCharFilterFactory[1] you can replace all zeros with "" before tokenizer. 

<charFilter class="solr.MappingCharFilterFactory" mapping="mapping.txt"/>

SolrHome/conf/mapping.txt file will contain this line:

"0" => ""

So that "01.10." will become "1.1." and  "022.300" will become "22.3" Is that you want?

[1]http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.MappingCharFilterFactory