Analyzer for numeric type of fields


(narinder.izap) #1

I need to analyaze and tokenize the numeric fields like zip_codes, which
analyzer should I use??? currently I am using the standard analyzer, with
with i can not search the partial zip_codes,
Expected is if i search for '45', then it should return all the zip_codes
starting with 45, but its returning result if i enter the full zip_code and
returns only single record.

Can anyone please guide me through this ???


(Shay Banon) #2

There isn't really a meaning for an analyzer on numeric values. They either
indexed or not.

On Tue, Jul 3, 2012 at 8:56 AM, Narinder Kaur narinder.kaur@izap.in wrote:

I need to analyaze and tokenize the numeric fields like zip_codes, which
analyzer should I use??? currently I am using the standard analyzer, with
with i can not search the partial zip_codes,
Expected is if i search for '45', then it should return all the zip_codes
starting with 45, but its returning result if i enter the full zip_code and
returns only single record.

Can anyone please guide me through this ???


(Jan Fiedler) #3

If I understand the post correctly, the question is very specific to ZIP
codes. They are numeric in may countries, but search requirements are
usually very different (from a number). A zip code often has some semantic
(like the first digit determining the state).

This said, I believe have to take a very careful look at your requirements
and setup a special analyzer for the zip code field. By default, your field
is detected as numeric and no analyzing process is applied. You want to
change that and analyze as string with a special analyzer (depending on
your requirements). I would look at an egde-ngram analyzer for starters.


(system) #4