Ready to get started?Download WordPress


Relevanssi - A Better Search
Build index and post types (2 posts)

  1. Remco Tolsma
    Posted 2 years ago #

    I'm having troubles with the Relevanssi configuration and indexing custom post types. I checked the source code and did some debugging but i can't find the problem.

    However, i think the configuration panel for custom post types is unnecessarily complicated. There are three fields to determine which post types should be indexed:

    - What to include in the index:
    - Custom post types to index:
    - Index and search your posts' attachments

    I think you can simplify it with an simple check list with all post types (http://codex.wordpress.org/Function_Reference/get_post_types). I did something similar in the Pronamic Google Maps plugin: http://s.wordpress.org/extend/plugins/pronamic-google-maps/screenshot-3.png?r=419182

    You could also improve the relevanssi_build_index() function. There are a lot of cases and if / else statements to create an complex query.

    AND ( post.post_type = 'post' OR post.post_type = 'page' OR post.post_type = 'attachment' OR post.post_type = 'project' OR post.post_type = 'event' OR post.post_type = 'file_page')

    Why don't you determine the post type that should be indexed with PHP and create an short and easy to read query like this:

    AND post.post_type IN ('post', 'page', 'project', 'event')

    That would save you a lot of if / else constructions and exploding and imploding comma separated strings.

    I tried everything to index the custom post types, but it's not working. I disabled the index of attachments but those are indexed.


  2. Mikko Saari
    Plugin Author

    Posted 2 years ago #

    Yes, the options page is mess in many ways and recent versions of Relevanssi Premium have taken steps to make it clearer. Eventually those improvements will trickle down ot free version.

    I don't know, indexing custom post types works for me, no problems with it, so hard to say what's wrong.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic