Reply To: Search term highlighting, included categories only, surrounding search term text

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search term highlighting, included categories only, surrounding search term text Reply To: Search term highlighting, included categories only, surrounding search term text


Ernest Marcinko

Hi Ronnie,

I see what the problem here is now. Let me explain with your example:

Searching for 'joel osteen' yielded some results, but there is no highlighting in some. Let's look at the first result, which is this:
When I open up that result, the words 'joel osteen' does not appear in this exact order anywhere in the text, therefore the context finder does not find it, it simply returns the beginning of the text as the context. It looks for the exact phrase, not partial, as often time one keyword may be far out of the context of the second (or third etc..).

The reason I asked for the FTP access, was that I wanted to try a possible modification where the context finder would look for an exact match first, then for a first word match, if no luck. In this case first 'joel osteen', if no context found, looks for 'joel' instead. I've made this modification, did a few tests, and it looks like it's much better, since where the exact phrase is not found, it displays the first keyword context instead. I will definitely include this in the upcoming release, as it seemingly does not hurt the performance, and gives much better context.

There are however ways you can improve this via configuration (if you want), but they will have a certain effect on your results:

Alternative Configuration 1
Enabling exact matches:
In this case the keyword logic is neglected, and the plugin will look for exactly matching phrases only. This will also ensure, that the results will always have both (or all) keywords highlighted when matching. Definitely a good choice, since you have a fairly large set of text to look for. It will also yield less results, but more accurate ones.

Alternative Configuration 2
Configuring and Using the index table engine.
This is a more difficult configuration, but the index table offers relevance based on keyword occurence. As you earlier mentioned you would expect some results to be higher, some lower – this will very likely solve that as well, as occurence of keywords is also calculated to relevance weight. This is impossible with the regular engine, the regular post fields are not built for that.

To properly configure the index table, please use these guides
Index table introduction
Generating the index table
Enabling index table engine

This alternative would be similar to what you have now, but with a likely better ordering based on relevance. And the index table relevances, you can adjust by manually inputting values, much higher like the ones for the regular engine:

I hope this helps!

Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)