Question

I have a complex searchable configuration for a domain class and its associated domain classes. when I search for about 200 results (max:200) it takes too long to respond.

in the result set I have all fields (simple or association) specified for search in my domain class. I need to return only an id list and ignore other fields of domain class. is it possible? I want to do this for speeding up my search. this id list will be used for querying another no-sql db. it seems that fetching all of the fields is slowing down my search.

Était-ce utile?

La solution

I think you can achieve what you want (let the property be searchable but not return it) by setting the property store to no.

For example:

class MyDomain {
    String name
    String email

    static searchable = {
        email index:'analyzed', store:'no'
        name index:'analyzed'
    }
}

In this domain I say that name and email are indexed and analyzed (so they can be searched) but the email property is not being stored, so it will be null when the object is returned. For other properties check: http://grails.org/Searchable+Plugin+-+Mapping+-+Searchable+Property

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top