WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
Custom post types marked are no show in admin results (16 posts)

  1. Michael Cannon
    Member
    Posted 2 years ago #

    I'm using relevanssi premium.

    As an admin, I've noticed that my custom post type video records, if marked as private are not showing up in the search results on the admin edit screen for videos.

    I'm searching on a custom meta field and if the video post is public, the desired singular video result is returned. If video post is private, nothing.

    I've tried to see in the relevanssi.php where the 'private' checks might be firing, but none do.

    Thoughts to resolving?

    http://wordpress.org/extend/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    That is expected behaviour.

    Is "Respect exclude_from_search for custom post types" checked or not? If it is, try unchecking it.

  3. Michael Cannon
    Member
    Posted 2 years ago #

    I don't think this is the issue.

    My public custom post types are show in admin search results. The private custom post types do not.

    I did a quick search for "private" on the options screen and didn't see anything.

    Any other ideas?

  4. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    Well, did you try unchecking the option? Because that's what controls whether the private post types are included in the search or not.

  5. Michael Cannon
    Member
    Posted 2 years ago #

    I did try it. I've even confirmed that under "Indexing options" that my custom post type are checked to be Indexed and denoted as yes to Public.

    If the custom post type was configured as exclude_from_search, the Public column would be no.

    Other ideas?

    I did confirm again that private items aren't in the search result, but public are.

  6. Michael Cannon
    Member
    Posted 2 years ago #

    I've put enough debug code into relevanssi.php to determine that private posts are removed from the wp_relevanssi table. It seems to be a general safeguard to keep the results out of the public side of things.

    I'll see if I can work up a patch.

  7. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    Ah, sorry, I misunderstood. I thought you were talking about private post types, but you were talking about private posts. Sorry about the confusion.

    Relevanssi does index private posts, at least it should. The indexing function fetches all published posts, drafts and private posts. There are methods to check if the private posts can be displayed to the searcher (see relevanssi_post_ok() function).

    So, if the private posts are not being indexed at all, there's a problem somewhere. Perhaps you could use these instructions to figure out where in the process the private posts are dropped off.

  8. Michael Cannon
    Member
    Posted 2 years ago #

    It seems from my quick debugging so far that Relevanssi indexes private posts, but then deleting the index on updates.

    Tonight, I'll dig into the problem further.

    I really appreciate the feedback. I've pushed 1.7.5 into my local SVN so that I can readily create a patch when I've got one.

  9. Michael Cannon
    Member
    Posted 2 years ago #

    I've fixed my issue. It's come down to two things.

    1. I needed to enable read_private_videos and read_private_documents for my roles.

    add_action( 'init', 'mbr_modify_roles' );
    
    function mbr_modify_roles () {
        global $wp_roles;
    
        $roles                      = $wp_roles->get_names();
    
        foreach ( $roles as $role => $value ) {
            $wp_roles->add_cap( $role, 'read_private_videos' );
            $wp_roles->add_cap( $role, 'read_private_documents' );
        }
    }

    2. I've added private to the allowed indexes to keep on indexing and updating index. Patch attached below.

    Index: relevanssi.php
    ===================================================================
    --- relevanssi.php	(revision 152)
    +++ relevanssi.php	(working copy)
    @@ -429,7 +429,8 @@
         }
    
     // END added by renaissancehack
    -	if ($post_status != 'publish') {
    +    $index_statuses = array('publish', 'private');
    +	if ( ! in_array( $post_status, $index_statuses) ) {
     		// The post isn't public anymore, remove it from index
     		relevanssi_remove_doc($post, true);
     	}
  10. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    Yeah, there's the bug. Relevanssi will also remove drafts from index at that stage. Thanks a lot for helping me to figure it out, I'll fix it in the next version (which should be coming soon, I've already got a bunch of small fixes to include so now it's just a question of having the time to write the code).

  11. Michael Cannon
    Member
    Posted 2 years ago #

    If you've got the fixes as patches, I can pull the code together and send back to you in whole for review and to offer up as beta to other.

    I've been thinking to put the Indexing actions to an Ajax process so that timeouts stop happening. This would mean a separate processing screen like that for my Flickr Shortcode Importer and TYPO3 Importer, http://wordpress.org/extend/plugins/flickr-shortcode-importer/screenshots/, than options.

    Have you also thought to move the options screen to an easier to handle class? Say something like http://plugins.svn.wordpress.org/flickr-shortcode-importer/trunk/class.options.php?

    Once I've started separating my options and processing screens, plugin development has gotten so much easier to manage. Also, less buggy.

    How do you maintain separate Relevanssi and Relevanssi Premium code bases?

    Thanks again for the Relevanssi efforts.

    Ciao,

    Michael

  12. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    I don't have any code done yet, just a bunch of ideas and bug reports on file. Hoping to have time to work through these this weekend.

    Ajax-powered indexing has been something I've wanted a long time, but at the moment it's beyond my skills. If you want to help with that, that'd be most welcome.

    I've been planning to fix the options page a long time, but it's lots of work and I'd have to do it twice to keep migrating from free to premium simple. I've been meaning to put all the options in one option field, for example, but it's been way too much work for now.

    I've got the free version in the SVN provided by WordPress.org and have git for Premium. Those are two completely different projects and sometimes a pain to maintain...

  13. Michael Cannon
    Member
    Posted 2 years ago #

    I'm wondering why not make the premium portion a single or two file include on the free?

    This way, maintenance would be easier since code sharing would be in place.

    I'd be happy to help with either version to give you a baseline for the Ajax indexing and options page. To me, this would be a fun project since I use Relevanssi for clients and myself.

    I'd like to start work with the WordPress SVN'd version so that we could have beta testers more readily ensure our efforts are solid. Then I can help you find an easier way to manage including the premium options.

    How are you handling bug reports? I never noticed if WordPress had a bug reporting option for us plugin contributors.

    Your thoughts?

  14. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    Let's take this to private email.

  15. jeffvand
    Member
    Posted 1 year ago #

    Is there any update to this in the plugin? We have a custom privacy condition set up (using presspermit) but that is excluding all these "private" pages from search results. I think a simple "include private posts in search results" would fix this issue for us.

    Thanks for any thoughts or updates you have on this one.

  16. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Yes. You can do this by writing a custom function that will tell Relevanssi what is allowed to current user.

    See the function relevanssi_s2member_level() and relevanssi_default_post_ok() in lib/common.php.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags