zoukankan      html  css  js  c++  java
  • lucene 范围搜索表达式(range expression)

    实际测试
    lucene范围符号,大于等于或小于等于符号[],大于或小于符号{}
     
    newIntRange或newLongRange一样
     
     
    代码:
              // test lucene expression
              BooleanQuery bQuery = new BooleanQuery();
             
              // test range expression
             
              // +LPUBLISHTIME1:{1 TO 3}
              NumericRangeQuery numRangeQuery1 = NumericRangeQuery.newIntRange("lpublishtime1".toUpperCase(), 1, 3, false, false);
              bQuery.add(numRangeQuery1, BooleanClause.Occur.MUST);
              System.out.println(bQuery);
             
              // +LPUBLISHTIME2:[1 TO 3}
              NumericRangeQuery numRangeQuery2 = NumericRangeQuery.newIntRange("lpublishtime2".toUpperCase(), 1, 3, true, false);
              bQuery.add(numRangeQuery2, BooleanClause.Occur.MUST);
              System.out.println(bQuery);
             
              // +LPUBLISHTIME2:[1 TO 3]
              NumericRangeQuery numRangeQuery3 = NumericRangeQuery.newIntRange("lpublishtime2".toUpperCase(), 1, 3, true, true);
              bQuery.add(numRangeQuery3, BooleanClause.Occur.MUST);
              System.out.println(bQuery);
  • 相关阅读:
    html语法
    mysql常见的使用语法
    文件相关命令
    linux文件管理
    mysql常见名词解释
    MySQL初识
    文件管理
    并发基础知识3
    Bash shell初识
    【Spring Boot】ActiveMQ 发布/订阅消息模式介绍
  • 原文地址:https://www.cnblogs.com/svennee/p/4080478.html
Copyright © 2011-2022 走看看