ruby on rails - Solr Search Stripping Phone Number in Database before Comparison -
I have a list of restaurants, which I want to match with the restaurant in my database using the phone number. The problem is that numbers are formatted separately (i.e. My current solar search looks like this: What thank you enter your phone number field Configure for (123) 123-1234 or
123 123-123 or other combination).
search = restaurant / Search (Phone, SanspotHelper, sanitize_term (pr.phone) .gsub (/ \ s + /, "")) with page: 1, per page: 15 end
SunspotHelper.sanitize_term (pr.phone) .gsub (/ \ s + /, "") will strip down my search query just numbers However, the values in my database now include other non-numeric characters And thus,
search.hits returns a blank array because I can not find any results.
It also enables you to index phone data in various formats and make them searchable.
You will not need to make any changes to the database
Comments
Post a Comment