Hi Mohammed, See my answers below, and hopefully they won't lead you too far astray. Note though, it has been a long time since I have done this and there are doubtless more knowledgeable people in this forum who will be able to correct anything I say that may be misleading or incorrect. Cheers, Andy Mohamed wrote: no one ?Hunspell is based on MySpell, extending it with support for complex compound words and unicode characters, however Postgresql cannot take advantage of Hunspell's compound word capabilities at present. Aspell is a GNU dictionary that replaces Ispell and supports UTF-8 characters. See http://aspell.net/test/ for comparisons between dictionaries, though be aware this test is hosted by Aspell... I will leave it to others to argue the merits of Hunspell vs. Aspell, and why you would choose one or the other. The ar.aff file that comes with OpenOffice Hunspell dictionary is essentially the same as the ar.affix I supplied. Just open the two up, compare them and choose the one that you feel is best. A Hunspell dictionary will work better with a corresponding affix file. The ar.stop file flags common words from being indexed. You will want a stop file as well as the dictionary and affix file. Feel free to modify the stop file to meet your own needs. If you want to support multiple language dictionaries for a single table, with each row associated to its own dictionary, use the tsvector_update_trigger_column trigger to automatically update your tsvector indexed column on insert or update. To support this, your table will need an additional column of type regconfig that contains the name of the dictionary to use when searching on the tsvector column for that particular row. See http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-UPDATE-TRIGGERS for more details. This will allow you to search across both languages in the one query as you were asking.
>From psql command line you can find out what templates you have using the following command: \dFtor looking at the contents of the pg_ts_template table. If choosing a Hunspell or Aspell dictionary, I believe a value of TEMPLATE = ispell should be okay for you - see http://www.postgresql.org/docs/current/static/textsearch-dictionaries.html#TEXTSEARCH-ISPELL-DICTIONARY. The template provides instructions to postgresql on how to interact with the dictionary. The rest of the create dictionary statement appears fine to me.
|