grails - 表的一部分的Lucene Grails可搜索插件构建索引

标签 grails lucene searchable compass-lucene

我有一个映射到具有标志列的表的可搜索域类。当前,Lucene创建索引时,它会生成如下查询(返回表中的所有数据):

        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));

关于grails - 表的一部分的Lucene Grails可搜索插件构建索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15097102/

相关文章:

java - Lucene 2.9 TokenStream API 是否比旧版本更快?

java - 如何实现自定义搜索结果排名?

text - 推荐什么文本处理工具来解析剧本?

grails - 检索特定父级的子级以显示在选择的组件上

ajax - grails中的远程文件上传

grails - 升级到 Grails 2.2 后的 MissingMethodException

grails - Grails sitemesh是否有不支持带有开放HTML正文标签的语句的解决方法?

java - 如何正确转义 lucene 查询?

grails - 可搜索插件无法解析 Grails 2.2.4 中的类

android - android studio 中可搜索的SearchView setSuggestionsAdapter()