Not getting accepted search result

124 views
Skip to first unread message

Prakash Sanyasi

unread,
Apr 20, 2020, 5:46:41 AM4/20/20
to Case Commons Development
I have created table with filed code and name, then implemented the pg_search. All is working perfectly, expect that I am not getting any result when I search for '5674' though I have record with code 'upc5674'. I am getting result when type whole word('upc5476'). Can anyone help me?

pg_search_scope :search, against: {
code: 'A', name: 'B'
}, using: {
tsearch: { dictionary: 'english', normalization: 2, prefix: true }
}

Grant Hutchins

unread,
Apr 20, 2020, 8:22:04 PM4/20/20
to Case Commons Development
Hello, Prakash.

It’s likely because of the lack of space between the letters and numbers in ‘upc5476’. You may want to consider something like trigram search in this case.

I used ts_parse to determine how the strings are being parsed by PostgreSQL below:

pg_search_test=# SELECT ts_parse('default', 'upc5476');

  ts_parse   

-------------

 (3,upc5476)

(1 row)


pg_search_test=# SELECT ts_parse('default', 'upc 5476');

 ts_parse  

-----------

 (1,upc)

 (12," ")

 (22,5476)

(3 rows)


Thanks!

Grant

Secure Link Services Group
Zürich: Innovation Center, Haldenstrasse 23, 8306 Brüttisellen, Switzerland
Dubai: Building 3, 3rd Floor, Dubai Design District, Dubai, United Arab Emirates
Dhaka: Midas Center, Road 16 (new), Dhanmondi, Dhaka 1209, Bangladesh
Thimphu: Bhutan Innovation Tech Center, Babesa, P.O. Box 633, Thimphu, Bhutan
Contact us: CH +41 (0)448058044 | US +1 213 260 1291www.selise.ch

Important Note: This e-mail and any attachment are confidential and may contain trade secrets and may well also be legally privileged or otherwise protected from disclosure. If you have received it in error, you are on notice of its status. Please notify us immediately by reply e-mail and then delete this e-mail and any attachment from your system. If you are not the intended recipient please understand that you must not copy this e-mail or any attachment or disclose the contents to any other person. Thank you for your cooperation.

--

---
You received this message because you are subscribed to the Google Groups "Case Commons Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to casecommons-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/casecommons-dev/2d8e1b00-3ba0-41f8-b1f9-f7d483846735%40googlegroups.com.

Prakash Sanyasi

unread,
Apr 21, 2020, 5:38:23 AM4/21/20
to Case Commons Development
Thank You
To unsubscribe from this group and stop receiving emails from it, send an email to casecom...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages