Hi Josh

There's a few approaches I can think of. First up is ignore_chars,  
which could be used to strip out slashes and dashes.
http://sphinxsearch.com/docs/current.html#conf-ignore-chars

However, a better approach might be to have three fields, all built  
off the same column (assuming MySQL, change as needed):

   indexes part_number
   indexes "REPLACE(part_number, '/', '')", :as => :part_number_no_slash
   indexes "REPLACE(REPLACE(part_number, '/', ''), '-', '')", :as  
=> :part_number_alphanumeric

It's not the neatest looking approach, but it would keep your query  
super-simple... well, provided you're not looking at focusing the  
search on a specific field. If that's the case, I'd probably wrap all  
three of the above options into a single field via raw SQL.

Hope this helps.

Cheers

-- 
Pat

On 24/02/2009, at 4:38 PM, Josh Owens wrote:

>
> Hey,
>
> I am trying to use Thinking Sphinx to match cisco part numbers, but I
> need to match a couple variations of the part number.
>
> For example: I have a part number: WS-C19/28EEUG.  I need to match the
> exact part number, but also WSC1928EEUG, and WSC-1928EEUG.  Is there a
> way to strip out non-alphanumeric characters for matching, or would I
> need to do it by hand in the search query and with an extra db field
> that gets indexed?
>
> Thanks for the help.
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to