Thread: [Postgresql NLS support] : Help on using NLS , Custom dictionary to enhance our website search functionality
[Postgresql NLS support] : Help on using NLS , Custom dictionary to enhance our website search functionality
From
Nivedita Kulkarni
Date:
Hello All,
We have newbie to Postgresql.
Background:
We have site hosted on Ruby on Rails using Postgresql database.It is a eCommerce site and for which we need to provide the NLS supported Search functionality to help end users while searching by using Synonyms, related word , Plurals and Singular , Stop words etc.
Problem
As per our analysis we found that with Postgresql NLS it possible to do following with any custom changes:
1. Participles (help,helps,helped,helping)2. Multi-word (search results)3. Single word (results)4. Plurals and Singular (s,es)5. Punctuation's (.,;,!,:,')6. Stop words (And, or, as , an, but)
Reading the documentation for Custom dictionary, We tried to use the Custom dictionary postgresql/9.3/tsearch_data and added following to test :
buy purchasebig enormousmammoth elephantindices index*
But we found that when we search for word "Purchase" we get search result for"Purchase" and "Buy" both.
But when we search for "Buy" then we don't get search result for "Purchase".
We are using following query to using which we found that transitive synonym search is not working for us.
SELECT "products".* FROM "products" WHERE (((to_tsvector('english', coalesce("products"."description"::TEXT, ''))) @@(to_tsquery('english', ''' ' || 'purchase' || ' '''))));
I think transitive support will be basic function and Postgresql database must have provided. Please let us know if some setting or configuration changes are needed to enable this feature.
Also as per our finding, following are points on which it seems there is no direct way in Postgresql:1. Related words (Pushchair buggies)2. Near by words (Pen , Pencil, Eraser)3. Synonyms (buy<=>purchase,big<=>enormous)4. Spelling Mistake
We look forward for feedback / suggestions our problem or suggest any alternative solution, how this can be done ?
Thanks in advance
Thanks and regards,
Nivedita Kulkarni
Nivedita Kulkarni