The application uses rails 4.2 and standard gem elasticsearch. An additional filter by synonyms was needed for the search. A dictionary and filter documentation was written. But for some reason, not all words from the dictionary are correctly searched.
'Π°ΠΏΠ°Ρ, Π°ΠΏΠ°ΡΠΈ, Π°ΠΏΠ°ΡΠ΅ => Apache' 'ΠΏΡ
ΠΏ => PHP' 'Π³ΠΈΡ, Π³ΠΈΡΡ
Π°Π± => Git' 'Π»ΠΈΠ½ΡΠΊΡ => Linux' 'ΠΊΠ»ΠΈΠ΅Π½Ρ-ΡΠ΅ΡΠ²Π΅Ρ => Client-Server' 'ΠΏΠΈΡΠΎΠ½, ΠΏΠ°ΠΉΡΠΎΠ½, python3, python2 => Python' This format dictionary written in a separate file.
synonym: { type: 'synonym', synonyms: Rails.root.join('config', 'elastic', 'synonyms_dictionary.txt').readlines.map(&:strip).join(',') }, and so its introduction to the filter looks like
The essence of the problem is that for some reason the search for synonyms behaves incorrectly. For example, \ by examples from the dictionary \, Π³ΠΈΡ - Π½Π΅ Π½Π°Ρ
ΠΎΠ΄ΠΈΡ Π·Π°ΠΏΠΈΡΠ΅ΠΉ , but Π³ΠΈΡΡ
Π°Π± - Π½Π°Ρ
ΠΎΠ΄ΠΈΡ Π·Π°ΠΏΠΈΡΠΈ ΠΏΠΎ ΡΠ»ΠΎΠ²Ρ git , ΠΏΠΈΡΠΎΠ½|ΠΏΠ°ΠΉΡΠΎΠ½|python3 - Π½Π΅ ΠΈΡΠ΅Ρ Π·Π°ΠΏΠΈΡΠΈ , but python2 - Π½Π°Ρ
ΠΎΠ΄ΠΈΡ Π·Π°ΠΏΠΈΡΠΈ ΠΏΠΎ ΡΠ»ΠΎΠ²Ρ python . ΠΠΈΠ½ΡΠΊΡ Π½Π°Ρ
ΠΎΠ΄ΠΈΡ Π·Π°ΠΏΠΈΡΠΈ Π²ΠΊΠ»ΡΡΠ°ΡΡΠΈΠ΅ ΡΠ»ΠΎΠ²ΠΎ Linux . And this is very strange and not understandable.