views:

18

answers:

1

I use Sphinx to index HTML pages, giving different weights to title, description, etc. I'm looking for a way to get the search words location in the page from the results that I get from Sphinx.

Meaning, if the wordset is "stack overflow program" and I have 5 documents that match, each of them was a match because it contained at least one word from the wordset.

The question is: how do I know where each word was found in a document? For example, I want to know if document 1 returned because it contained "overflow" in the title and "stack" in the description.

I see that the result returns with a certain weight (3780, for example) but I can't conclude from that on what word was found where.

Thanks a lot!

A: 

You'll have to (somehow) get the results back programmatically, and then you can call BuildExcerpts on the contents. Sphinx will then give you an HTML block with the relative positions of the found text.

gms8994