• Hi,

    My client spotted a couple of anomalies, which I have now fixed by tweaking the settings but during the testing process I used the standard WordPress search widget (as well as some mySQL searches) and discovered that Ajax Search is giving slightly different results to the standard search….

    For a specific search for the word “Eason” Ajax Search returns 7 posts and WordPress returns 9 posts but there is one post unique to the Ajax Search results (not seen in WordPress search) and in the WordPress search there are two posts that are unique to the WordPress search results (that are the actual word) and are not seen in Ajax results.

    So I should be seeing 10 results. Here is a summary of the posts per search:-

    AJAX SEARCH LITE
    ================
    =1. /met-son-of-veterans-air-express-charles-eason-sr/
    =2. /charles-eason-non-pilot-veterans-air-express-founder/
    =3. /veterans-air-expanded-friendships/
    4. /visiting-veterans-air-express-families-2017/ (captions)
    =5. /veterans-air-express-family-visits-first-day/
    =6. /veterans-air-express-crew-list/
    =7. /veterans-air-line-memorabilia/

    WORDPRESS SEARCH
    ================
    =1. /met-son-of-veterans-air-express-charles-eason-sr/
    =2. /charles-eason-non-pilot-veterans-air-express-founder/
    =3. /veterans-air-expanded-friendships/
    =4. /veterans-air-express-family-visits-first-day/
    =5. /veterans-air-express-crew-list/
    6. /1946-veterans-air-express-crew/ (text in body)
    7. /veterans-air-express-unrra-contract/ (text in body)
    =8. /veterans-air-line-memorabilia/
    9. /journal-to-my-dad/ (text in body)

    Any ideas why this is happening and what can we do to get a comprehensive set of results?

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi!

    Thank you for all the details, it helps me a lot.

    The difference of results comes for two reasons:
    1. The search uses an own search algorithm, that is somewhat different from the built-in WordPress one.

    2. From the front-end settings, I see you have the search in post contents option disabled. That means, the search will not look for matches within post/page contents. By turning that option on, you will get more matches for sure.

    I hope this helps!

    Best regards,
    Ernest M.

    Thread Starter Adendum

    (@adendum)

    Ernest,

    Thanks for getting back.

    1. OK, so WordPress and AS use different algorithms but neither are 100% accurate. Is there any way to tweak AS so it picks up a 100% match or is that asking the impossible.

    2. I had to change the settings to exclude the in post content because the results were littered with far too many ‘partial matches’. In the example of the search on the name “Eason” the results included every post and page that had the word ‘reason’ or ‘reasons’ and also those with ‘season or seasons’ and the client didn’t like that.

    Plugin Author wpdreams

    (@wpdreams)

    Hi,

    That depends on what is the definition of 100% match. I belive you need whole word matches only, for that you can change the search Keyword logic to respect that on the General Options -> Behaviour panel: https://i.imgur.com/HCdjq5p.png
    It will notice you about possible limitations, as recognizing whole word matches can be a very performance heavy task.

    If you need more accurate word matching, the Pro version has an optional feature (index table engine), that extracts the keywords from post fields for occurence based relevance matching, and uses a separate database table to overcome the performance issue.

    Best regards,
    Ernest M.

    Thread Starter Adendum

    (@adendum)

    Ernest,

    Well, by 100% match I meant that if I search for ‘Eason’ in this site that I get the 10 matches because there are 10 instances of that word in posts.

    I have just changed the behaviour setting from “OR” to “AND with…” and acknowledge the limitations of that setting (spaces only)

    So my biggest concern here is that a search for “Eason” produces only 7 post results but there are 3 more that are not showing up.

    Plugin Author wpdreams

    (@wpdreams)

    Hi,

    On those 3 other missing matches, which field contais the word ‘Eason’? (title, content, excerpt etc..)

    Thread Starter Adendum

    (@adendum)

    Ernest,

    They are all in the content.

    If you set ‘Search in content’ (now set by default) I now get 9 results. So the change from ‘OR’ to ‘AND with…’ has made an improvement….just that last one result not being picked up.

    The missing post is this one:-

    https://veteransair.org/veterans-air-express-unrra-contract/

    Plugin Author wpdreams

    (@wpdreams)

    Hi,

    Thanks! That indeed will not be returned with that logic, as in the database it is stored within HTML tags, like so:

    <em><strong>Paul Eason</strong></em>

    Basically the string ‘Eason’ is followed by a ‘<‘ character, which is neither the end of the field, nor a space character, so it is not considered as a word ending by the database query. This is a perfect example on why matching individual words within raw content is difficult (in terms of query), and is limited to only space and word endings only.

    Best regards,
    Ernest M.

    Thread Starter Adendum

    (@adendum)

    Ernest,

    But there are other posts where the name is wrapped in html and those are picked up. See this example – picked up in the search correctly:-

    https://veteransair.org/journal-to-my-dad/

    So what do you suggest I do to the settings to pick up that last post – or is that never going to be possible?

    • This reply was modified 6 years, 3 months ago by Adendum.
    Plugin Author wpdreams

    (@wpdreams)

    Hi,

    I checked the content source, and in that specific case, there is a space after the tag (probably accidentally):

    <strong>Charles Eason </strong>

    and because of that, it matches.

    Well, there is no option to bypass this, as it is not possible without pre-processing. A possible solution could be to perhaps use post tags, or a custom field to enter additional keywords (in case of custom field, space separated list of words). Then either enable the search within terms option, or select the custom field containing the additional keywords.

    Thread Starter Adendum

    (@adendum)

    Ernest,

    Would the Pro version improve on the results do you think?

    Plugin Author wpdreams

    (@wpdreams)

    Hi,

    For your requirements very likely, but only by using the index table engine.

    Best regards,
    Ernest M.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Different search results from WordPress search’ is closed to new replies.