views:

137

answers:

3

When you search "Stack Overflow", Sphinx will not bring up results that match "Stackoverflow"

That's because Sphinx indexes "Stackoverflow" as one word...whereas the query is two words.

Does anyone know how to fix this? (like Google...they can join the query !)

A: 

Couldn't you just combine the search terms into one words before sending them to sphinx? You would need to do all permuations of serach terms, ie my search term as mysearch, mysearchterm, and searchterm, but that seems like it would work.

Byron Whitlock
+1  A: 

There's no need to tamper with data being fed to Sphinx. All you need to do is to slightly modify the search request to Sphinx in your form processing code so that it contained various combinations of search terms and use SPH_MATCH_EXTENDED matching mode. In particular, for your example

(Stack Overflow) | stackoverflow
codeholic
Where do I put that code?
TIMEX
result_ids = cl.Query ( q, index ) . That's what I have so far.
TIMEX
This doesn't work: cl.Query ( ("talk radar") | "talkradar", index )
TIMEX
You should put that inside quotes. Like this: cl.Query ( "(talk radar) | talkradar", index )
codeholic
Oh, I see what you mean. Just change it in the query? So if the query was "stack overflow"...modify that string to do the OR operator...right? I'm using python btw
TIMEX
Yep. That's how I do it.
codeholic
+1  A: 

You can use the wordforms feature to map words to different words, or to match many words to a single word. If you have a lot of words you want to correct, you could do this. I think if you used this feature you would only have to do a single search, and it would probably be faster than doing an "or" search.

Kibbee