• Resolved jdyach

    (@jdyach)


    Hi, I am trying to understand how the search results are (not) working. To explain, I have my (custom) posts set up with categories and tags. When I am on the category “Shade Accessories” and search for the term “485,” I would expect that the posts first listed in the results would be ones that include the term “485”. I have the following settings for Weights:
    Titles: 5, Tag weight: 4, Category weight: 3, Content: 2, Comment text: 1.

    There are 2 posts with “485” in the title, and 15 with the tag “485” but only 3 results come up. I also have some posts tagged with “485,” such as one called “Janus” that are not showing up.

    The same results are presented in the Admin search. I attempted to use Query Monitor (following your instructions) but A) I do not see anything in the Queries part, under “Caller” as relevanssi_search() [or anything specifically related to Relevanssi that I can tell] and B) I’m also getting this error message w/ Query Monitor despite manually creating the symlink via WP-CLI and allowing all permissions to the directory/files: “Extended query information such as the component and affected rows is not available. Query Monitor was unable to symlink its db.php file into place.”… and finally when implementing the php filters (described here: https://www.relevanssi.com/knowledge-base/debugging-relevanssi-searching-issues/), these are my results:

    string(797) "SELECT DISTINCT(relevanssi.doc), relevanssi.*, relevanssi.title * 5 + relevanssi.content * 2 + relevanssi.comment * 1 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM siwpmulti_4_relevanssi AS relevanssi WHERE (relevanssi.term LIKE '485%' OR relevanssi.term_reverse LIKE CONCAT(REVERSE('485'), '%')) AND ( relevanssi.doc IN ( SELECT DISTINCT(posts.ID) FROM siwpmulti_4_posts AS posts WHERE posts.post_type IN ('screen', 'shade', 'accessories') ) ) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM siwpmulti_4_posts AS posts WHERE posts.post_status IN ('publish'))) OR (doc = -1)) ORDER BY tf DESC LIMIT 500"

    …so doesn’t seem to be matching the weight params that I entered, if I’m understanding this correctly?

    Note that I am also using the “Search & Filter” plugin and this is a multisite.

    Please let me know if you have any ideas about what I am missing or could be going on here.

    Thank you!

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mikko Saari

    (@msaari)

    First of all, yes, I found some bugs in how Relevanssi handles the term and category weights in the free version, and the weights didn’t work correctly. I’ll fix that in the next version. In any case, the bug does not stop the tagged posts from appearing in the search results.

    There’s nothing alarming in the MySQL query: no zero weights at the wrong places and the only restrictions are the post type restriction and the restriction to published posts.

    I’d rather start the debugging here without Search & Filter –?I’m not terribly familiar with how it works, and what effect it may have. But you’re saying the results are exactly the same with the Relevanssi admin search? Looking at the basic search results (at URL /?s=485), I see 16 results, including the Janus, but no posts with “485” in the title.

    If you look at one of the posts with the “485” in the title, for example, the “RTS Receiver for 485” (post ID 6020), with the Relevanssi debugger (Settings > Relevanssi > Debugging), what does it look like? Does Relevanssi index the word “485” in the post title correctly?

    Thread Starter jdyach

    (@jdyach)

    Hmmm! The result from Relevanssi debugger (Settings > Relevanssi > Debugging) is: “Nothing found for ID 6020.”

    Why do think that would be?

    THX

    • This reply was modified 2 years, 5 months ago by jdyach.
    Plugin Author Mikko Saari

    (@msaari)

    Well, there’s your reason why the post cannot be found: it is not indexed. If you reindex, does the post get indexed then?

    Thread Starter jdyach

    (@jdyach)

    I have re-indexed several times, and just tried again, but this time I toggled on “Custom fields: visible,” which has given me slightly different results, but “State of the index” seems to be stuck at “10 documents in the index.” And still “Nothing found for ID 6020.”. Initially it says “Counting posts… 96 posts found.” (exact number of post I’m attempting to index).
    When I turn on “Create custom search result snippets” I get a bunch of results, but also not what’s expected (“485” pulls up things that aren’t named or tagged as such). I can see weird description for those posts that include 485 in them, but not sure where those are coming from?

    Thread Starter jdyach

    (@jdyach)

    Ahhh, I think something weird happened when I used “Post Type Switcher” plugin to convert pages over to custom posts. Any newly added posts seem to be populating in the results as expected ??

    Also, unchecking “Expand shortcodes when indexing” I believe both helped eliminate some erroneous indexing as well as sped up the indexing process a TON!

    Looking forward to the term and category weights being fixed in the next update.

    Thanks so much for your time and excellent plugin!

    Plugin Author Mikko Saari

    (@msaari)

    Yeah, based on what you wrote I was going to suggest disabling shortcodes. It looks like you have a shortcode that confuses Relevanssi. A post loop or something like that – it makes Relevanssi switch the post ID in the middle of a post, which leads to the post data being indexed under the wrong post ID.

    This is also not the first time someone has problems with Post Type Switcher.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Unexpected search results’ is closed to new replies.