views:

38

answers:

0

I'm trying to utilize the termFreqs method provided by the Searchable plugin to generate a keyword cloud for the most popular terms found in an indexed domain class. The problem is, I only want to get the term frequencies for a subset of the records in the database. I have the following classes:

class Text {
  String title
  String content
  static hasMany = [searches: Search]
  static belongsTo = Search
  static searchable = {
    only = ['title', 'content']    
  } 
}

class Search{
  static belongsTo = [project: Project]
  static hasMany = [results: Text]
  static searchable = {
    only = ['id']    
  }
}

class Project{
  String name
  static hasMany = [searches: Search]
}

I only want the termFreqs of Text objects that appear in searches for a particular project. Is there a way to do this with the searchable plugin? Or, failing that, is there some way to get the same result by directly invoking the underlying Compass/Lucene architecture?