Support » Plugin: Relevanssi - A Better Search » Indexing seems to be broken

  • Jason Ryan

    (@viablethought)


    Hello –

    I just tried to rebuild the Index in my site (which only consists of 2 CPTs and their taxonomies) and the Indexing never finishes:

    http://g.recordit.co/vjgc5HxitT.gif

    It discovers the total number of posts to Index, but it hits that number and just keeps going and going.

    Any insights would be greatly appreciated.

    Thanks

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

    (@msaari)

    I can’t see the gif, it’s 403 Forbidden.

    Do you have any filter functions that affect the indexing? Any exclusions or restrictions?

    Jason Ryan

    (@viablethought)

    @msaari

    Hmmm, that’s weird, should be a publicly accessible link. Maybe try this one:

    Screencast

    It’s a pretty vanilla install on the plugin, I only have it set to index the 2 Custom Post Types and their associated taxonomies (2 each). Combined I believe there are about 400 posts. No other settings were touched in the plugin.

    Let me know if you need any additional information.

    Thanks

    Plugin Author Mikko Saari

    (@msaari)

    You can try this:

    add_filter( 'relevanssi_indexing_query', 'rlv_test_indexing_query' );
    function rlv_test_indexing_query( $query ) {
        error_log( $query );
        return $query;
    }

    This will make Relevanssi log the indexing query it runs to the error_log, so you can see what it is trying to do. For some reason the indexing query keeps finding posts – that does sound like something is excluded from the search in a way that Relevanssi doesn’t quite understand correctly, and thus Relevanssi keeps on trying to index it again and again.

    Are all your posts indexed? What does the “Lowest post ID in the index” show? The actual lowest post ID, or something else? If all posts are in the index, then this probably doesn’t matter much, as you don’t need to index all the posts again.

    Jason Ryan

    (@viablethought)

    Hello @msaari

    Added the code but nothing was added to the error_log from Relevanssi? Does the script create an error_log other than the root directory that I am just not seeing?

    Here’s the “State” of the Index info:

    1 document in the index.
    79 terms in the index.
    2037 is the lowest post ID indexed.

    How do I determine what is being “excluded” from search other then what is in the Post Type selection meta box, because everything there looks normal?

    Thanks

    Jason Ryan

    (@viablethought)

    @msaari

    Think maybe the saved Index is possibly corrupt? If I disable Relevanssi and use the default WordPress search I get search results that relate to the searched keyword. If I reenable the plugin, I don’t get the same results. In fact, they are worse.

    Example:

    Without plugin, searched keyword: “punch” – 27 results returned

    With plugin, same searched keyword – 1 result returned

    So something with the plugin is causing issues with the returned results. Is there a way to delete whatever saved index there is and start over?

    Thanks.

    Plugin Author Mikko Saari

    (@msaari)

    That function shouldn’t actually print out anything until you run the indexing. Sorry I forgot to mention that. Try rebuilding the index and see if that prints out anything in the error log. Clicking “Build the index” will wipe out the index and start rebuilding it from scratch.

    Relevanssi does say you only have one document indexed, so that does explain why you’re seeing just one result in the search: there just isn’t anything else in the index for Relevanssi to find.

    So no matter what the Relevanssi indexing process says, it has actually indexed just one post, and that’s why you’re not seeing any results. There’s something wrong with the indexing process that’s blocking it from working as usual. It’s something to do with the indexing queries, most likely.

    Jason Ryan

    (@viablethought)

    @msaari

    I figured it wouldn’t print anything until I tried re-indexing, but even after attempting to run 2 times, nothing had shown up in the error log… assuming it is the error log within the root directory.

    So if only “1 document” is indexed, then how is Relevanssi then saying when it tries to rebuild the index that it is finding the correct number of posts to rebuild from, which is that “422” number – which is the correct numder of posts?

    Where do I go from here?

    Thanks

    Plugin Author Mikko Saari

    (@msaari)

    Without the indexing queries, not very far… without knowing what Relevanssi is trying to do in the first place, it’s difficult to say why it’s not working.

    It would be strange if Relevanssi didn’t find the correct number of posts in the database – that’s a very simple database query and if Relevanssi is reporting a wrong number of posts there, that would be a signal of a bigger problem.

    But when indexing, Relevanssi is doing repeated queries for more posts, and that is somehow failing. For some reason Relevanssi is probably indexing the same posts over and over again, and that’s why it’s never stopping, either – there’s always more posts to index as the indexing query keeps on returning more posts that Relevanssi hasn’t indexed.

    But without knowing what kind of parameters the indexing query is getting, I don’t know why Relevanssi is doing that. The default query shouldn’t do that.

    Also when Relevanssi is indexing at least 10 posts at the time, why is only one post indexed?

    Well, one explanation comes to mind: if your posts have something in them that changes the global $post object, that would throw Relevanssi off the loop. For example if there’s a shortcode that for some reason changes the global $post object to point to the post ID 2037, that would get you something like this: Relevanssi would get a batch of new posts to index, but because the $post object changes, they all would be indexed as post 2037, leading to pretty much what you’re seeing here.

    If you have the shortcode expansion enabled, try disabling it. Does that help?

    Jason Ryan

    (@viablethought)

    @msaari

    Interestingly enough, I deleted the plugin and reinstalled it knocking out the old index and was able to successfully rebuild the index. However, at the same time, I did deselect the “expand shortcode” option.

    So I ran a second test with it selected, then the issue popped up again so it definitely has something to do with the shortcodes included in those Post Types.

    Thanks for taking the time to work through this with me, seems to be back to normal now and search results are showing as expected.

    Jason

    Plugin Author Mikko Saari

    (@msaari)

    Definitely a shortcode that’s changing the global $post object then.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.