[Postgresql NLS support] : Help on using NLS , Custom dictionary to enhance our website search functionality

From: Nivedita Kulkarni <nkulkarni(at)genius-minds(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Cc: Nilesh Padbidri <npadbidri(at)genius-minds(dot)com>
Subject: [Postgresql NLS support] : Help on using NLS , Custom dictionary to enhance our website search functionality
Date: 2015-05-26 06:46:04
Message-ID: 1439336814.1497372.1432622764921.JavaMail.yahoo@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-novice

Hi 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 purchase

big enormous

mammoth elephant

indices 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Piotr Gasidło 2015-05-26 07:45:56 Re: Replacing uuid-ossp with uuid-freebsd
Previous Message Francisco Olarte 2015-05-26 06:42:00 Re: FW: Constraint exclusion in partitions

Browse pgsql-hackers by date

  From Date Subject
Next Message Shulgin, Oleksandr 2015-05-26 06:50:42 Re: [PATCH] Generalized JSON output functions
Previous Message Michael Paquier 2015-05-26 06:39:34 Re: Supporting TAP tests with MSVC and Windows

Browse pgsql-novice by date

  From Date Subject
Next Message Hans Ginzel 2015-05-26 08:57:53 psql readline Tab insert tab
Previous Message Daniel Begin 2015-05-22 10:36:47 Constraint exclusion in partitions