0

I am Using SunSpot Solr for Searching text and zip codes through my application. I am searching through the model like below,

  searchable do
    text :city
    integer :zip
  end

  def self.search_with_solr(search_word)
    search = Hometown.solr_search do
      fulltext(search_word)
    end
    search.results
  end

Whenever I search through for zip codes and city (eg. 123 and blah) it returns me result, But if I search for zips that start with 0 (eg. 001243) it doesnt return me the result.

I guess configuration needs to be changed in schema.xml. I tried Every combination but in vein. Would be obliged if I get a quick response.

Aditya
  • 144
  • 7
  • You might want to include your schema.xml next time. But having to guess I think using N-Grams will fix your problem. – Okke Klein Oct 09 '13 at 12:42
  • Okke: Thanks a lot buddy. I have used N-Grams Filter Factory. Just got a solution! I was using a integer field for storing zip codes. I used string with character limit of 6 and I got the results in searches! Will post as answer. – Aditya Oct 10 '13 at 05:11

1 Answers1

0

Turns out to be a small change!

I was using INTEGER as data type for storing zips. Converted it into STRING with character limit of 6 and got results!

Aditya
  • 144
  • 7