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 marotosg <ma...@gmail.com> on 2012/01/19 11:19:08 UTC

Searching partial phone numbers

Hi. 
I have phone numbers in my solr schema in a field. At the moment i have this
field as string.
I would like to be able to make searches that find parts of a  phone number.

For instance: 
Number +35384589458
 
search by  *+35384* or search by  *84589*.

Do you know if this is posible?

Thanks a lot

--
View this message in context: http://lucene.472066.n3.nabble.com/Searching-partial-phone-numbers-tp3671908p3671908.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Searching partial phone numbers

Posted by marotosg <ma...@gmail.com>.
Hi.
I found the solutions for that.

You can apply a new filter for that field. It´s possible to define a type
text field with a new filter 
*<filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/>*

That means you will generate the reverse of the phone number.
For instance
08774589 and after that the reverse is 98547780.
Becaouse * only works  at the end  like 985* you can now user the next *774*
and it will find it in the middle 
of the string .

Basically you can search for any combination inside the string.


--
View this message in context: http://lucene.472066.n3.nabble.com/Searching-partial-phone-numbers-tp3671908p3675032.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Searching partial phone numbers

Posted by Patrick Plaatje <pp...@gmail.com>.
Hi Marotosg,

you can index the phonenumber field with the ngram field type, which allows
for partial (wildcard) searches on this field. Have a look here:

http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.CommonGramsFilterFactory

Cheers,

Patrick



2012/1/19 marotosg <ma...@gmail.com>

> Hi.
> I have phone numbers in my solr schema in a field. At the moment i have
> this
> field as string.
> I would like to be able to make searches that find parts of a  phone
> number.
>
> For instance:
> Number +35384589458
>
> search by  *+35384* or search by  *84589*.
>
> Do you know if this is posible?
>
> Thanks a lot
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Searching-partial-phone-numbers-tp3671908p3671908.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Patrick Plaatje
Senior Consultant
<http://www.nmobile.nl/>