Is there a way to query for keywords and grab the previous x amount of words and the next x amount of words?
Example
(Searching for “Test”)
Aa bb cc dd ee ff gg hh ii jj kk ll Test mm nn oo pp qq rr ss tt…
Where x was 5 would return
“hh ii jj kk ll Test mm nn oo pp qq rr ss”
With “Test” highlighted.
or
(Searching for “Test” AND/OR “Spam”)
Aa bb cc dd ee ff gg hh ii jj kk ll Test mm nn Spam oo pp qq rr ss tt…
Where x was 5 would return
“hh ii jj kk ll Test mm nn Spam oo pp qq rr ss tt”
With “Test” and “Spam” highlighted.
Any help would be much appreciated. I’ve been looking into Regex but I’m quite clueless there. Here are the resources I’ve been using. Also, my contains $,. and other random punctuation (tried going down the isolate by sentences). Let’s just assume spaces to separate.
http://wiki.apache.org/solr/HighlightingParameters/
Thanks!
Use the Highlighting tool – it will give you snippets of the matched document with the search terms italicized (in HTML). You can then home in on those markers (
<em>) and then go backward and forward character by character until you accumulate five space characters.