3

I tried to combine multiple text search to use it into text search on postgresql. I tried :

Create text search configuration test (
copy = english, french
)

But this didn't work:

text search configuration parameter "french" not recognized

I have a column which mixed of english french words and I want to get multiple configuration texts to search the queries items. Example:

to_tsvector('test', words) @@ to_tsquery('test','activité')
to_tsvector('test', words) @@ to_tsquery('test', 'mystery')

How can I mix different text configurations to get result when I look for a french or english word?

1 Answer 1

1

The French text search configuration uses French stemming (the french_stem dictionary), while for English english_stem is used.

How do you want to stem for both? You could create a text search configuration that applies both stemmers, but I guess that the result would not be convincing. Similar for stop words.

You can explicitly specify the text search configuration in the query if you know what language you want to search for.

5
  • is not possible to combine different text search configuration in just one config? or should I add a column in the database to specify the language and after that choose the right config for each language?
    – Slim
    Nov 6, 2017 at 10:25
  • A column with the appropriate language would be a good option. Stemming (removal of suffixes) follows different rules. Also, is "pour" a stop word or not? In French it is and will be removed, in English it isn't. Nov 6, 2017 at 10:41
  • I have a question: what about when a user enter a text to search how to know the origin language of this word? It will be an additional work to detect the language of the entered text to search then choose the suitable configuration text search.
    – Slim
    Nov 6, 2017 at 15:54
  • That's not easy. Either you can ask the user what language it is, or you choose some default (and then possibly get not as good results). You can search in French texts using an English configuration, but there will be false positives and negatives. Nov 6, 2017 at 16:01
  • do you know what other solution were used for the search text on the websites?
    – Slim
    Nov 6, 2017 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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