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.

Comments

stijndmd created an issue. See original summary.

bhojwanipankaj05’s picture

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

bhojwanipankaj05’s picture

Status: Needs work » Closed (works as designed)

Synonyms Multilingual support implemented with the new release 2.0.2

stijndmd’s picture

Status: Closed (works as designed) » Needs review

will review this tomorrow

stijndmd’s picture

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.

bhojwanipankaj05’s picture

@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.

bhojwanipankaj05’s picture

Status: Needs review » Closed (works as designed)
joseph.olstad’s picture

Status: Closed (works as designed) » Active

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",                                   
joseph.olstad’s picture

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}}                                                                            
                                                                                       
joseph.olstad’s picture

Status: Active » Fixed

assuming this is fixed and it's just me

bhojwanipankaj05’s picture

Status: Fixed » Needs review
StatusFileSize
new73.03 KB

@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"}

Reference screenshot attached. Please check

After registering resource you can follow the synonym export command.

bhojwanipankaj05’s picture

Status: Needs review » Closed (outdated)