WordPress.org

Ready to get started?Download WordPress

Forums

WP Search
Index Taxonomies? (1 post)

  1. v.pellegrineschi
    Member
    Posted 3 years ago #

    I need and hack to index also all term of any taxonomies of each post.
    It works ok, but search excerpt display all terms...

    I patched Phplucene.php file on drivers subfolder, near

    ADD:
    $addc=""; $taxonomies=get_taxonomies();
    foreach ($taxonomies as $taxonomy ) {
    $terms=wp_get_object_terms( $post->ID, $taxonomy, null);
    foreach ($terms as $term) {
    $dr= (array) $term;
    $addc .= $dr["name"]." ";
    };
    };
    $post->post_content .= $addc;

    BEFORE:

    $comments = ($index_comments ? $this->_getCommentsAsString($post->ID) : FALSE);
    $categories = ($index_categories ? $this->_getCategoriesAsStrings($post->ID) : FALSE);
    # WPSearch_Log::add('debug', "Indexing post: $post->ID");
    $index->addDocument($this->_createLuceneDocument($post, $categories, $comments));

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic