• 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 15 replies - 16 through 30 (of 33 total)
  • Plugin Author WPSolr free

    (@wpsolr)

    You need to re-index completely your 2 indexes, if they existed before.

    Thread Starter TomasJerrySebo

    (@tomasjerrysebo)

    OK. I will try it one more time anew completly removing all of them.

    Plugin Author WPSolr free

    (@wpsolr)

    Just empty, and synchronize all your indexes (in “Solr indexing Batch” tab)

    Thread Starter TomasJerrySebo

    (@tomasjerrysebo)

    Ok I tried everything. It always says it indexed only 1 document. When I’m using the polylang integration. We have three languages and it indexes 1 document for each language. As if the query would find only one result to index.

    Plugin Author WPSolr free

    (@wpsolr)

    Please contact me on the wpsolr.com chat box.

    Thread Starter TomasJerrySebo

    (@tomasjerrysebo)

    already on the chat now

    Plugin Author WPSolr free

    (@wpsolr)

    Check the POLYLANG version.

    Thread Starter TomasJerrySebo

    (@tomasjerrysebo)

    Yea will do that. Thanks for the advice

    Plugin Author WPSolr free

    (@wpsolr)

    I’ll upgrade the plugin integrations with the minimum compatible version tested.

    Plugin Author WPSolr free

    (@wpsolr)

    You can also index with the “debug” checkbox.

    You’ll see the sql generated to retrieve the posts in the index’s language.

    You can eventually understand if the data models changed since your POLYLANG version.

    Thread Starter TomasJerrySebo

    (@tomasjerrysebo)

    Hey,
    so I updated the polylang plugin just like we said. In fact I updated all the plugins we have and the wpsolr still finds only 1 document to index if polylang integrations is turned on. I turned on also the debug and this is the sql query which is run :

    SELECT ID, post_modified, post_parent, post_type FROM wp_posts AS posts JOIN wp_term_relationships AS wp_term_relationships ON posts.ID = wp_term_relationships.object_id AND wp_term_relationships.term_taxonomy_id = ‘5051’ WHERE ( ( post_status=’publish’ AND ( post_type in (‘post’,’page’,’polylang_mo’,’post_paper’,’post_video’,’post_podcast’,’post_infographic’,’post_htmlpapers’) ) ) OR ( ( post_status=’publish’ OR post_status=’inherit’ ) AND post_type=’attachment’ AND post_mime_type in (‘application/pdf’) ) ) ORDER BY post_modified ASC

    with polylang integration turned on and this is the one without it :

    SELECT ID, post_modified, post_parent, post_type FROM wp_posts AS posts WHERE ( ( post_status=’publish’ AND ( post_type in (‘post’,’page’,’polylang_mo’,’post_paper’,’post_video’,’post_podcast’,’post_infographic’,’post_htmlpapers’) ) ) OR ( ( post_status=’publish’ OR post_status=’inherit’ ) AND post_type=’attachment’ AND post_mime_type in (‘application/pdf’) ) ) ORDER BY post_modified ASC

    The first returns only one post the second one returns 7800 posts. I checked and it must be something with that wp_term_relationships.term_taxonomy_id = ‘5051’ because that limits it to one post. Is that some kind of language ID in polylang which should define which posts to choose based on that ID ?

    Thank you

    Plugin Author WPSolr free

    (@wpsolr)

    yes, 5051 should contain the language definition that you selected for this index in your polylang integration settings.

    You should have something like that in your wp_term_taxonomy table:

    5051 5051 language a:2:{s:6:”locale”;s:5:”fr_FR”;s:3:”rtl”;i:0;} 0 123

    Thread Starter TomasJerrySebo

    (@tomasjerrysebo)

    ok so I got the problem my wp_term_relationships.term_taxonomy_id isn’t 5051 but 5581 … look …

    5581 5051language a:2:{s:6:”locale”;s:5:”en_US”;s:3:”rtl”;s:1:”0″;}

    5051 is the term_id

    5581 is the term_taxonomy_id

    How can we fix this ?

    Thanks

    Thread Starter TomasJerrySebo

    (@tomasjerrysebo)

    term_taxonomy_id term_id taxonomy count
    5581 5051 language a:2:{s:6:”locale”;s:5:”en_US”;s:3:”rtl”;s:1:”0″;} 3916

    Here is a better version

    Plugin Author WPSolr free

    (@wpsolr)

    In my own version of POLYLANG, term_id is always equal to term_taxonomy_id.

    But it seems term_id should be used in the sql query.

    Can you replace (line 80 of file wpsolr-search-engine/classes/extensions/polylang/plugin-polylang.php):

    $sql_joint_statement .= " ON posts.ID = wp_term_relationships.object_id AND wp_term_relationships.term_taxonomy_id = '%s' ";

    by

    $sql_joint_statement .= " ON posts.ID = wp_term_relationships.object_id AND wp_term_relationships.term_id = '%s'  AND taxonomy = 'language'  ";

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