• Resolved holisticremedysearch

    (@holisticremedysearch)


    does anyone know why there is a searchable posts index and a posts index ?

    all my posts should be searchable but the counts are different and it wastes an index on my free plan with Algolia…

Viewing 15 replies - 1 through 15 (of 32 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Good day,

    This is largely a detail that WebDevStudios inherited when we code forked the plugin that Algolia themselves were originally developing and maintaining for WordPress, before they abandoned.

    The purpose, from the best I can surmise, is that they intended it to be a case of autocomplete can have their own separate “sections” in the suggestions in that UI component. You could and still can section them off by content type, including various post types, taxonomy terms, and even user search if you really wanted that. Because of that, each content type gets its own index and configuration as well.

    Then there’s algolia + native search template and instantsearch. That setting and those options received their own isolated index separate from the potential autocomplete indexes. This searchable posts index also has a requirement that the post types can’t be marked as “excluded from search” with their registration, thus the “searchable posts” naming convention. This index also doesn’t have taxonomy/user integration.

    That said, if you’re wanting the autocomplete suggestions and the search results to all be pulling from one index, we recommend having Autocomplete use the “All Posts” option, which will reuse the “searchable posts” index.

    Hope that helps explain some of the design decisions in the plugin.

    Thread Starter holisticremedysearch

    (@holisticremedysearch)

    yeah, i do want to share that.

    Thread Starter holisticremedysearch

    (@holisticremedysearch)

    so is it safe to delete one ? i want to share results for both auto complete and full page results

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I would first update your Autocomplete settings to just use “All Posts” which will share the same index as your either instantsearch or algolia + native template settings. I don’t know which you’re using at the moment.

    Then test some things out, compare results etc, to make sure you’re getting what you’re expecting.

    Once you’re happy, you can go in and remove any indexes that aren’t named wp_searchable_posts or whichever has your chosen index prefix.

    The nice thing is that you can always re-build the extra indexes if somehow needed.

    Thread Starter holisticremedysearch

    (@holisticremedysearch)

    not following here, i want one index that has all my posts, both instant search and auto complete.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    This option here for autocomplete:

    Screen Shot

    Uses the exact same index as either of these from the search page settings:

    Screen Shot

    So since you’re wanting both to use the exact same index for the posts aspect of the site, make sure you have “All posts” checked as one of sources in Autocomplete. Given that I’ve had links to the site before, I can confirm you’re already using Instantsearch.

    Using say this “Posts” setting from autocomplete, creates a different index separate from the search page settings. Based on what I’ve seen in the incoming responses from the API, you are using the wp_posts_post index which won’t be the index used with the search page.

    Thread Starter holisticremedysearch

    (@holisticremedysearch)

    so i can choose “searchable_posts” but how do i delete posts_posts. it keeps coming back and adding confusion. wasting an index in Algolia

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Make sure you’ve unchecked this one shown below and clicked “Save Changes” at the bottom of the page.

    Screen Shot

    You should only have the “All Posts” item checked on the Autocomplete page.

    If you do have this unchecked, and it’s still returning, then is it possible you also have everything still set and in place on a development/staging copy of the site that may be pushing to the same indexes/application?

    Thread Starter holisticremedysearch

    (@holisticremedysearch)

    but how can i get removed from this page ? i think whenever new posts are created, the index gets created automatically again. i just created a new post and now index is back and has one record

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    If that setting is unchecked, and you’ve hit save, wp_posts_post should not be getting created any more. This would be the only place where that index name is getting used at. If it still is somehow, then I’m not sure how and would need to be able to investigate the install to see what may be going on.

    Beyond that, if you have any code snippets that are still using the algolia_post_shared_attributes action/filter, that’s the only way I could see it **potentially** still getting created.

    Worth testing out if you remove any/all code based customizations to see if the index itself still get recreated. If it does with all the customizations removed, then something is definitely odd here. If it doesn’t get recreated with them removed, then we have a more solid lead of what to review.

    For what it’s worth, I did just turn off “posts” post type for autocomplete, added a quick filter/callback that uses that index, and then published a brand new post in that post type, and no new index was created from it. So at least for the moment, I can’t recreate the issue. That’s not me doubting you’re experiencing it, but something must be going on that I am not able to discern from here.

    Thread Starter holisticremedysearch

    (@holisticremedysearch)

    these are the functions i have now: https://snipboard.io/OHuKmv.jpg

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Ok, I could see that algolia_posts_index_settings line from line 225 creating indexes persistently because it’s pushing settings for an index, and it’d need to create the index first. However, you’d still need the Autocomplete “Posts” index enabled as well for content to get pushed into it as well.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Adding in since we’re using the “searchable posts” index in your intent, the filter you would have wanted would be algolia_searchable_posts_index_settings and now I’m wondering if this is part of why were not getting the snippeting working for you. Wrong filter usage.

    Thread Starter holisticremedysearch

    (@holisticremedysearch)

    snippet is working, all that remains is why posts_post and searchable_posts have different counts

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    “posts_post” index is only going to have the published posts from the “post” post type.

    “searchable_posts” index is going to have all published posts from all public post types that aren’t set to be excluded from search as part of their registration.

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