I'm trying to do the following with Sphinx search results, and I can't quite 
wrap my head around how to use the excerpt function to do it.

I have a collection of HTML documents in the database, and it's quite large 
(each one is a book, as one page of HTML). Search results are naturally in 
context, and the excerpt function shows the found terms highlighted, as I 
expect. But now I need to anchor down to that paragraph, UL (whatever the 
nearest parent container with an ID is, basically), when I link to the results. 
Since the excerpt function is not aware of the content format, I'm not sure how 
to go about finding this, or more accurately, avoiding having the html cut 
apart by the window of the excerpt engine such that the nearest parent ID is 
missing.

Does this question make sense? Can anyone offer a suggestion? At the moment, I 
am looking at creating a shadow column in my contents table with the HTML, and 
a plain_text column where the actual searching takes place, and then use a 
Nokogiri scraper on each search result's html to grab the nearest ID for the 
hits. (So I'll be searching twice -- once in Sphinx to find the short list of 
matches, and again using Nokogiri on the matches.) This will be a bunch of 
work, so I'm hoping there is another way that someone else has already figured 
out.

Thanks,

Walter

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to