Searchable Plugin

Searchable Plugin : Search 'BE' or 'IT' no results returned

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Not A Bug
  • Affects Version/s: 0.5
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Grails Searchable 0.5.5
  • Testcase included:
    yes

Description

In my leagacy DB (oracle) I have a table :
Users
id
name
country_code

I have tese data :
1|test1|FR
2|test2|IT
3|test3|BE
4|test4|FR
5|test5|PL

I created a Domain class :
class Users{
static searchable = true
String name
String countryCode
}

In my test:
...
Users.searchable('countryCode:FR', params) = return all users with FR
Users.searchable('countryCode:PL', params) = return all users with PL
Users.searchable('countryCode:BE', params) = no results for BE
Users.searchable('countryCode:IT', params) = no results for IT
...

I repeated this on 2 apps

See Integration Tests attached

  1. Users.groovy
    16/Mar/10 9:20 AM
    0.1 kB
    Jonathan Lebrun
  2. UsersTests.groovy
    16/Mar/10 9:20 AM
    1 kB
    Jonathan Lebrun

Activity

Hide
Jonathan Lebrun added a comment -

Grails version : 1.2.1

Show
Jonathan Lebrun added a comment - Grails version : 1.2.1
Hide
Peter Ledbrook added a comment -

The plugin is working as expected. The problem you have is that 'it' and 'be' are common words and Compass does not index them by default.

You can resolve this by configuring a dedicated analyzer that doesn't ignore these 'stop' words. Simply run

grails install-searchable-config

and modify the resulting grails-app/conf/Searchable.groovy file so that the compassSettings option contains:

compassSettings = [ 'compass.engine.analyzer.simple.type': 'Standard', 'compass.engine.analyzer.simple.stopwords': '' ]

Then, inside your domain class, replace static searchable = true with

static searchable = {
    countryCode analyzer: "simple"
}
Show
Peter Ledbrook added a comment - The plugin is working as expected. The problem you have is that 'it' and 'be' are common words and Compass does not index them by default. You can resolve this by configuring a dedicated analyzer that doesn't ignore these 'stop' words. Simply run
grails install-searchable-config
and modify the resulting grails-app/conf/Searchable.groovy file so that the compassSettings option contains:
compassSettings = [ 'compass.engine.analyzer.simple.type': 'Standard', 'compass.engine.analyzer.simple.stopwords': '' ]
Then, inside your domain class, replace static searchable = true with
static searchable = {
    countryCode analyzer: "simple"
}
Hide
Jonathan Lebrun added a comment -

GReat thanks. It's working fine now

Show
Jonathan Lebrun added a comment - GReat thanks. It's working fine now

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: