Module is hardcoded to only create the english synonyms solr config file

Created on 17 May 2023, over 1 year ago
Updated 27 February 2024, 9 months ago

Problem/Motivation

This module is hardcoded to only create the _schema_analysis_synonyms_english.json, from synonyms in whichever language is chosen in the drush command drush solr-search-synonym:export --plugin=solr_uploader --langcode=[INSERT_LANGCODE].

You can instances of $path = 'schema/analysis/synonyms/english'; in /src/Plugin/solr_search_synonym/export/SolrUploader.php and in /src/Controller/SolrSynonymUploaderBatchExport.php

Steps to reproduce

  • Enable and configure the module in a multilingual site.
  • Add synonyms in another language than English
  • drush solr-search-synonym:export --plugin=solr --langcode=[YOUR_CHOSEN_LANGCODE]
  • drush solr-search-synonym:export --plugin=solr_uploader --langcode=[YOUR_CHOSEN_LANGCODE]

The result is a _schema_analysis_synonyms_english.json files you can witness here: admin/config/search/search-api/server/[SERVER]/files with in it synonyms of your chose language, that only have an effect in an english site search.

Proposed resolution

On every drush solr-search-synonym:export --plugin=solr_uploader --langcode=[YOUR_CHOSEN_LANGCODE], we need to replace the hardcoded path variable $path = 'schema/analysis/synonyms/english'; by the path for the corresponding language. Or we need to just remove the language from the drush command and upload all synonyms to their correct language solr config file.

Remaining tasks

Create a partch / merge request.

🐛 Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

🇧🇪Belgium stijndmd

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @stijndmd
  • 🇮🇳India bhojwanipankaj05

    Hi @stijndmd,
    Thank you for investigating this. I am checking the case and will resolve this as earliest possible.

  • Status changed to Closed: works as designed over 1 year ago
  • 🇮🇳India bhojwanipankaj05

    Synonyms Multilingual support implemented with the new release 2.0.2

  • Status changed to Needs review over 1 year ago
  • 🇧🇪Belgium stijndmd

    will review this tomorrow

  • 🇧🇪Belgium stijndmd

    I'm confused as to why we have to pick one langauage for the managed resource mapping in configuration.

    What's needed is the possibility to map the resources via drush for all the languages on the website.

    Proposed resolution

    On every drush solr-search-synonym:export --plugin=solr_uploader --langcode=[YOUR_CHOSEN_LANGCODE], we need to replace the hardcoded path variable $path = 'schema/analysis/synonyms/english'; by the path for the corresponding language. Or we need to just remove the language from the drush command and upload all synonyms to their correct language solr config file.

  • 🇮🇳India bhojwanipankaj05

    @stijndmd If we are importing synonyms using drush command like - drush solr-search-synonym:export --plugin=solr_uploader --langcode=[YOUR_CHOSEN_LANGCODE]
    here we can just pass langcode, its not related with configured language in admin synonyms setting. language configuration works with Import to Solr button in the admin synonyms listing page, where we need to change the language before importing data using Import to Solr button for a specific language.

  • Status changed to Closed: works as designed over 1 year ago
  • Status changed to Active 12 months ago
  • 🇨🇦Canada joseph.olstad

    For some reason it's pushing out an unrecognized parameter, perhaps instead of français the endpoint is expecting french?

    joseph_internet:~/project (Précision-Recherche *) $ drush solr-search-synonym:export --plugin=solr_uploader --langcode=fr
    Starting synonym export....
    
    In SolrConnectorPluginBase.php line 1089:
                                                                                                                                                      
      Solr endpoint https://s7015-us-east-1.sr-prod02.acquia.com:443/solr/EKUX-177489.dev.ramqinter/ bad request (code: 400, body: No REST managed r  
      esource registered for path /schema/analysis/synonyms/français, message: Solr HTTP error: Bad Request (400)                                     
      {                                                                                                                                               
        "responseHeader":{                                                                                                                            
          "status":400,                                                                                                                               
          "QTime":1},                                                                                                                                 
        "error":{                                                                                                                                     
          "metadata":[                                                                                                                                
            "error-class","org.apache.solr.common.SolrException",                                                                                     
            "root-error-class","org.apache.solr.common.SolrException"],                                                                               
          "msg":"No REST managed resource registered for path /schema/analysis/synonyms/français",                                                    
          "code":400}}                                                                                                                                
      ).                                                                                                                                              
                                                                                                                                                      
    
    In SearchSubscriber.php line 197:
                                                                                                    
      Solr HTTP error: Bad Request (400)                                                            
      {                                                                                             
        "responseHeader":{                                                                          
          "status":400,                                                                             
          "QTime":1},                                                                               
        "error":{                                                                                   
          "metadata":[                                                                              
            "error-class","org.apache.solr.common.SolrException",                                   
  • 🇨🇦Canada joseph.olstad

    ok I hard coded it to 'french' , similar error. I'm not sure what is going on. Support request to acquia likely.

     Solr HTTP error: Bad Request (400)                                                          
      {                                                                                           
        "responseHeader":{                                                                        
          "status":400,                                                                           
          "QTime":0},                                                                             
        "error":{                                                                                 
          "metadata":[                                                                            
            "error-class","org.apache.solr.common.SolrException",                                 
            "root-error-class","org.apache.solr.common.SolrException"],                           
          "msg":"No REST managed resource registered for path /schema/analysis/synonyms/french",  
          "code":400}}                                                                            
                                                                                           
  • Status changed to Fixed 12 months ago
  • 🇨🇦Canada joseph.olstad

    assuming this is fixed and it's just me

  • Status changed to Needs review 12 months ago
  • 🇮🇳India bhojwanipankaj05

    @josepholstad As it shows No REST managed resource registered for français and french path. You just need to register resource by adding this below line with POST or PUT method in postman or any other API management platform.

    {"class":"org.apache.solr.rest.schema.analysis.ManagedSynonymFilterFactory$SynonymManager"}or reference

    Reference screenshot attached. Please check

    After registering resource you can follow the synonym export command.

  • Status changed to Closed: outdated 9 months ago
Production build 0.71.5 2024