2013-02-26 86 views
1

我有一個可搜索的域類映射到具有標誌列的表。目前,當Lucene的創建它產生這樣的查詢索引(返回表中的所有數據):Lucene Grails可搜索的插件構建索引的部分表

 select this_.id as id0_0_, 
       this_.flag as flag2_0_0_, 
       this_.email as email0_0_, this_.first_name as first6_0_0_, this_.last_name as last8_0_0_ 
     from ais_person this_ 
     order by this_.id asc 

是否有可能建立一個索引只有那些含有特定的標誌值的行,從而使生成的查詢將如下所示:

select this_.id as id0_0_, 
      this_.flag as flag2_0_0_, 
      this_.email as email0_0_, this_.first_name as first6_0_0_, this_.last_name as last8_0_0_ 
    from ais_person this_ 
    where this_.flag = 'Y' 
    order by this_.id asc 

回答

0

是的,我認爲你可以做到這一點。以下是僞代碼。

Document doc = new Document(); 
doc.add(Field.Text("flag", Y));