• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in searchable plug in.(Sort)

 
Praveen Kumar
Ranch Hand
Posts: 133
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am working searchable plugin in grails app to have sophisticated search functionality in my app.

Though it is working exceptionally well, Here i have small doubt i have.

Suppose i have domain property as name and the values for the name in the DB is :

Praveen race
Praveen Kuma race
Praveen Kumar Race

When i searched as "Praveen race" the data is coming as

Praveen Kuma race ............................
Praveen Kumar Race ..............................
Praveen race ....................................

But the user expects Praveen race row is the first one as there is exact match with "Praveen race" right ?. I have not configured any sort functionality.

Please help me out.




 
sergio ramirez
Greenhorn
Posts: 4
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Praveen!

Grails searchable plugin uses Lucene's StandardAnalyzer so if you declared index properties as "analyzed" then are lowercased to normalize it, so.. it doesn't matter if you have:

Praveen Kuma race ............................
Praveen Kumar Race ..............................
Praveen race ....................................

they will always be indexed as:

praveenkumarace ............................
praveenkumarrace ..............................
praveenrace ....................................

and your search term will be normalized too.
If you don't want to normalize you could use "not_analyzed" and it's value will reamain verbatim in the index.
I recommend you to read http://grails.org/Searchable+Plugin+-+Analyzers if you want to know more about them.

Regards,
Serch
 
Praveen Kumar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. You helped me a lot :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic