Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3223396
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:06:08+00:00 2026-05-17T16:06:08+00:00

Using the Grails Searchable plugin, I’ve got these classes: class Person { static searchable

  • 0

Using the Grails Searchable plugin, I’ve got these classes:

class Person {
 static searchable = {
  address component: true
    }
}

and:

class Address {
 static searchable = {
  root false
 }
 String country
}

I want to do a specific search for persons from a specific country. “country:NL” doesn’t work. “address:country:NL” doesn’t work either. I can’t find anything about the syntax for this. Any ideas?

I think I’ll have to do some clever indexing or some other trick in the searchable closure, but I just can’t find it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:06:09+00:00Added an answer on May 17, 2026 at 4:06 pm

    I created a basic app (Grails 1.3.5, Searchable 0.5.5.1) with your two classes and searching for ‘country:NL’ works for me. Did you remember to call index() before trying to search?

    grails create-app search
    grains install-plugin searchable
    

    Person:

    class Person {
      static searchable = {
        address component: true
      }
    
      Address address
    }
    

    Address:

    class Address {
      static belongsTo = Person
      static searchable = {
        root false
      }
      String country
    }
    

    Bootstrap:

    class BootStrap {
    
        def init = { servletContext ->
    
          def p1 = new Person(address:new Address(country:'NL')).save()
          def p2 = new Person(address:new Address(country:'DE')).save()
          def p3 = new Person(address:new Address(country:'NZ')).save()
    
          Person.index()
    
        }
    
        def destroy = {
        }
    }
    

    Then I browsed to to /searchable and searched for country:NL and got person 1 returned.

    If you want to see what Searchable is doing under the covers with regards to fields/indexes etc – Luke is a very handy tool (just download the executable JAR): http://code.google.com/p/luke/

    The index files are in

    <user.home>/.grails/projects/<project name>/searchable-index/development/index
    

    cheers

    Lee

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Grails app, I'm using the Searchable plugin for searching/indexing. I want to
using Grails 1.1.1 I have domain in Grails Person. Person can be related to
I'm using Grails Mail plugin and trying to send email and keep getting: Error
I'm developing a Grails (Version 1.3.3) Web-Application using the Grails Spring-Security Plugin, Spring-Security-Core-1.0.1 (which,
I'm using Grails 1.1 beta2. I need to import a large amount of data
I am developing a Web Album using Grails and for image processing, I am
How do I increase the maxPoolSize in Grails when using mysql? It appears to
Does anyone know how to initiate a POST request in a Grails applications using
I'm using the layout support (sitemesh) in Grails which works fine. I'd like to
Using Grails' GSP <g:set> tag, is it possible to specify the type of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.