WordPress.org

Ready to get started?Download WordPress

Forums

WP Search
[resolved] Error: Same index for different blogs in wordpress network (2 posts)

  1. DKesberg
    Member
    Posted 2 years ago #

    I'm using wpsearch in a wordpress network with 2 blogs in subdirectories.

    When i run the search, wpsearch always uses the last build index even if the index doesnt belong to the current blog.

    Example:
    1. I build the index for "Blog 1"
    2. I build the index for "Blog 2"
    3. I go the the frontend of "Blog 1" and run a search.

    Result: Only posts from "Blog 2" are shown in the results

    Ive tried upgrading to the last plugin version, deinstalling/installing the plugin, activating the plugin in blog dashboard, activating the plugin in network dashboard.

    No method resulted in a different search indexes, i always have the same index regardless of which blog i search in.

    Thanks in advance :)

    Ps: If i deactivate the Plugin, the searches work fine

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

  2. DKesberg
    Member
    Posted 2 years ago #

    I've found a solution.

    For anyone interested:

    1. Locate the setConfig() function in /plugins/wpsearch/WPSearch/Config.php

    2. Add access to the global $wpdb object

    Before:

    public function setConfig()
        {
    
            $config = array();
            # Set config values below

    After:

    public function setConfig()
        {
    
            global $wpdb;
    
            $config = array();
            # Set config values below

    3. Locate the phplucene config array in the setConfig() function

    4. Change the index path:

    Before:

    'index-path'     => dirname(__FILE__) . '/Backends/Phplucene/data/',

    After:

    'index-path'     => dirname(__FILE__) . '/Backends/Phplucene/data/' . $wpdb->prefix .'/',

    Now WPSearch will create a separate index for each blog in a wordpress network.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags