Lucene Grails可搜索的插件构建索引的部分表
问题描述:
我有一个可搜索的域类映射到具有标志列的表。目前,当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
答
是的,我认为你可以做到这一点。以下是伪代码。
Document doc = new Document();
doc.add(Field.Text("flag", Y));