0
votes

I have a solr schema where i store zipcodes in a text fieldtype.

But solr only gets results if i search for the whole zipcode. It doesnt get any results if the zipcode isnt completed.

In example:

I type 12345 - solr gets the zipcode 12345.

I type 1234 - solr doesnt get any results.

Somebody of you got an idea how to resolve this problem?

Must i use any tokenizers on that field or anything else?

THX for help

1
Search with a wild card at the end i.e. q=field:1234*arun

1 Answers

3
votes

Check for EdgeNGramFilterFactory filter

<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="25" side="front"/>

EdgeNGramFilterFactory generates edge grams for the token e.g.

12345 would generate -> 12, 123, 1234, 12345 .....

You can use this at index time to generate the tokens. So when you search for 1234, documents with 12345 would match