• Resolved TomasJerrySebo

    (@tomasjerrysebo)


    Hey,
    We are running a multilungual web running three languages with solr as our search engine with self hosted servers. Up until now we used an older solr and we found your plugin which is up to date so we are working on implementing it. This is the link for the plugin we used : https://www.ads-software.com/plugins/advanced-search-by-my-solr-server/ .

    Everything seems running the only thing is that we are using POLYLANG (1.5.5.) as our application for different translations and your plugin doesn’t natively supports the language intregrations with this plugin. It would be immensly diffucult for us to switch to WPML language plugin which is natively suppertod, because we have really custom complex logic behind the POLYLANG plugin.

    We were thinking of creating different indexes / cores for each languages and map it on each on of them. But before I start working on it I would like to ask if you could give us some best practises or recommedation how to handle this with the least ammount of work.

    Thank you

    https://www.ads-software.com/plugins/wpsolr-search-engine/

Viewing 3 replies - 31 through 33 (of 33 total)
  • Thread Starter TomasJerrySebo

    (@tomasjerrysebo)

    I tried to change the set_sql_query_statement function in the plugin-polylang.php as following and it’s working :

    function set_sql_query_statement( $sql_statements, $parameters ) {
    global $wpdb;

    // Get the index indexing language
    $language = $this->get_solr_index_indexing_language( $parameters[‘index_indice’] );

    // Get the languages
    $languages = $this->get_languages();

    // Retrieve the term_id used for this language code
    if ( ! isset( $languages[ $language ][‘term_id’] ) ) {
    throw new ErrorException( sprintf( “The language ‘%s’ is undefined in %s (not in the taxonomy terms).”, $language, static::_PLUGIN_NAME_IN_MESSAGES ) );
    }

    $language_term_id = $languages[ $language ][‘term_id’];
    $term = get_term($language_term_id,’language’);
    $term_taxonomy_id = $term->term_taxonomy_id;

    if ( isset( $language ) ) {

    // Join statement
    $sql_joint_statement = ‘ JOIN ‘;
    $sql_joint_statement .= $wpdb->prefix . self::TABLE_TERM_RELATION_SHIPS . ‘ AS ‘ . ‘wp_term_relationships’;
    $sql_joint_statement .= ” ON posts.ID = wp_term_relationships.object_id AND wp_term_relationships.term_taxonomy_id = ‘%s’ “;

    $sql_statements[‘JOIN’] = sprintf( $sql_joint_statement, $term_taxonomy_id );
    }

    return $sql_statements;
    }

    I want to ask you . Could you check it please … Thank you It’s working for me.

    Thread Starter TomasJerrySebo

    (@tomasjerrysebo)

    I tried to replace it but it throws an error . It worked with my modification.

    Plugin Author WPSolr free

    (@wpsolr)

    Thanks. I fixed WPSOLR 7.4 with your code.

Viewing 3 replies - 31 through 33 (of 33 total)
  • The topic ‘SOLR and POLYLANG integration’ is closed to new replies.