• Resolved DLee Morris

    (@dleemorris)


    Hello,

    I am needing to search only the content of a specific Learndash course via Post ID. I added this code … add_filter( ‘relevanssi_content_to_index’, ‘rlv_index_post_id’, 10, 2 );
    function rlv_index_post_id( $content, $post ) {
    $content .= ‘ ‘ . $post->ID;
    return $content;
    }

    But not sure how to add on the course page for the shortcode. I tried this .. [searchform post_id=”2204″] but does not work. I did reindex as well. Can you please advise?

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

    (@msaari)

    There’s no post_id parameter for the searchform shortcode. What that code does is to make it possible to search for “2204” and find the post 2204.

    It’s possible but meaningless to have Relevanssi only search on one page. It just doesn’t make any sense: either the word appears on the page or not. That’s all, and I think that’s frankly no use to any user whatsoever. If you’re looking for a search that searches on the current page, nothing beats the browser on-page search.

    Thread Starter DLee Morris

    (@dleemorris)

    Thanks for the fast response. I guess I worded it incorrectly. I a needing to know if possible to search the entire contents of a course that is identified by a post id. Lets compare to a blog. Lets say I have 3 separate blogs on the same site. And I want to have a search feature on each each blog page that only searches that blog and not the others. I am wanting a user to be able to search a specific courses content. Thanks again and sorry for communication issue.

    Plugin Author Mikko Saari

    (@msaari)

    What is a Learndash course in WP terms (assume I know nothing of Learndash)? Is it a single post? If so, searching for it in Relevanssi will return either the whole course or nothing. Is that useful?

    On a blog search is useful, because you’ll find the post that has the content you want. However, doing a search in a blog that will result in “yes, this blog has this content” is not particularly useful.

    That’s why it’s not very helpful to search within a single post, because a single post is the smallest unit Relevanssi can return as a result. Relevanssi can’t point to a part of a post, so the search can’t take the user to the part of the post that has the content the user is looking for.

    Perhaps there’s something in Learndash that means searching within one post makes sense, but at least in general it just does not.

    Thread Starter DLee Morris

    (@dleemorris)

    Thanks so much again. I will close this support topic. Thanks again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search by Post ID for Learndash course search’ is closed to new replies.