2

Having custom module dependency injection as follows:

  1. di.xml in app/code/Custom/Stopwords/etc directory.

    <type name="Magento\Elasticsearch\SearchAdapter\Query\Preprocessor\Stopwords">
     <arguments>
         <argument name="stopwordsDirectory" xsi:type="string">app/code/Custom/Stopwords/etc/stopwords</argument>
     </arguments>
    

  2. stopwords_en_US.csv in app/code/Custom/Stopwords/etc/stopwords directory copied from vendor.

Dev docs guide which i'm referring

Edit

I would like to add few stopwords in the .csv file. Have added the stop-words as follows:

more less some few other misc all

Issue - after adding the above stop-words it is not getting applied.

1
  • Is there any question or problem?
    – Mario
    Dec 22 '19 at 14:31
1

I ran into the same issue that you had following the documentation provided. You were following the Change Stopword Directory instead you want to follow the instructions under To change the directory from your module

In you custom module etc/di.xml file add in the following

<type name="Magento\Elasticsearch\SearchAdapter\Query\Preprocessor\Stopwords">
<arguments>
   <argument name="stopwordsModule" xsi:type="string">Your_Module</argument>
   <argument name="stopwordsDirectory" xsi:type="string">stopwords</argument>
</arguments>

Then make sure to copy vendor\magento\module-elasticsearch\etc\stopwords\stopwords.csv to app/code/Your/Module/etc/stopwords/stopwords.csv and add your words at the end of the file adding a new line for each word.

Once you are done I recommend rebuilding the indexes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.