当前位置: 首页>>代码示例>>Java>>正文


Java QueryBuilders.regexpQuery方法代码示例

本文整理汇总了Java中org.elasticsearch.index.query.QueryBuilders.regexpQuery方法的典型用法代码示例。如果您正苦于以下问题:Java QueryBuilders.regexpQuery方法的具体用法?Java QueryBuilders.regexpQuery怎么用?Java QueryBuilders.regexpQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.index.query.QueryBuilders的用法示例。


在下文中一共展示了QueryBuilders.regexpQuery方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import org.elasticsearch.index.query.QueryBuilders; //导入方法依赖的package包/类
/**
 * Here to establish QueryBuilder patterns
 */
void test() {
	SearchSourceBuilder b;
	BoolQueryBuilder qb = QueryBuilders.boolQuery();
	QueryBuilder qbmm = QueryBuilders.multiMatchQuery("name", "fieldNames");
	QueryBuilder qbm = QueryBuilders.matchQuery("name", "text");
	QueryBuilder qbmp = QueryBuilders.matchPhraseQuery("name", "text");
	QueryBuilder qb1 = QueryBuilders.termQuery(ITQCoreOntology.TUPLE_SUBJECT_PROPERTY, "");
	QueryBuilder qb2 = QueryBuilders.termQuery(ITQCoreOntology.TUPLE_OBJECT_PROPERTY, "");
	QueryBuilder qb3 = QueryBuilders.termQuery(ITQCoreOntology.INSTANCE_OF_PROPERTY_TYPE, "");
	qb.must(qb3);
	qb.should(qb1);
	qb.should(qb2);
	QueryBuilder partial = QueryBuilders.regexpQuery("name", "regexp");
	QueryBuilder wildcard = QueryBuilders.wildcardQuery("name", "query");
}
 
开发者ID:topicquests,项目名称:backside-servlet-ks,代码行数:19,代码来源:ElasticQueryDSL.java

示例2: createLexicalQuery

import org.elasticsearch.index.query.QueryBuilders; //导入方法依赖的package包/类
private static QueryBuilder createLexicalQuery(String key, Map<String, Object> rangeOperation,
    Float boost) {
  QueryBuilder queryBuilder = null;
  for (Map.Entry<String, Object> it : rangeOperation.entrySet()) {
    if (it.getKey().equalsIgnoreCase(STARTS_WITH)) {
      if (isNotNull(boost)) {
        queryBuilder = QueryBuilders.prefixQuery(key + RAW_APPEND, (String) it.getValue())
            .boost(boost);
      }
      queryBuilder = QueryBuilders.prefixQuery(key + RAW_APPEND, (String) it.getValue());
    } else if (it.getKey().equalsIgnoreCase(ENDS_WITH)) {
      String endsWithRegex = "~" + it.getValue();
      if (isNotNull(boost)) {
        queryBuilder = QueryBuilders.regexpQuery(key + RAW_APPEND, endsWithRegex).boost(boost);
      }
      queryBuilder = QueryBuilders.regexpQuery(key + RAW_APPEND, endsWithRegex);
    }
  }
  return queryBuilder;
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:21,代码来源:ElasticSearchUtil.java

示例3: testForClient

import org.elasticsearch.index.query.QueryBuilders; //导入方法依赖的package包/类
@Test
public void testForClient() throws Exception {
    QueryBuilder qb = QueryBuilders.regexpQuery(
            "name.first",
            "s.*y");
    client.prepareSearch().setQuery(qb).execute().actionGet();
}
 
开发者ID:felayman,项目名称:elasticsearch-full,代码行数:8,代码来源:RegexpQueryDemo.java

示例4: suffixQuery

import org.elasticsearch.index.query.QueryBuilders; //导入方法依赖的package包/类
/**
 * Builds a string suffix query.
 *
 * <p>
 *     Tests if the attribute of an instance ends with the specified value.
 * </p>
 * <p>
 *     Used internally in {@link IndexedStore#findAll(Params)} or in custom search methods in inheriting classes.
 * </p>
 * <p>
 *     This query is considerably slower than prefix query due to the nature of indexing. Should be avoided if
 *     possible.
 * </p>
 *
 * @param name Name of the attribute to check
 * @param value Value to test against
 * @return Elasticsearch query builder
 */
default QueryBuilder suffixQuery(String name, String value) {
    return QueryBuilders.regexpQuery(name, ".*" + value);
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:22,代码来源:IndexedStore.java

示例5: containsQuery

import org.elasticsearch.index.query.QueryBuilders; //导入方法依赖的package包/类
/**
 * Builds a string contains query.
 *
 * <p>
 *     Tests if the attribute of an instance contains the specified value.
 * </p>
 * <p>
 *     Used internally in {@link IndexedStore#findAll(Params)} or in custom search methods in inheriting classes.
 * </p>
 * <p>
 *     This query is considerably slower than prefix query due to the nature of indexing. Should be avoided if
 *     possible.
 * </p>
 *
 * @param name Name of the attribute to check
 * @param value Value to test against
 * @return Elasticsearch query builder
 */
default QueryBuilder containsQuery(String name, String value) {
    return QueryBuilders.regexpQuery(name, ".*" + value + ".*");
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:22,代码来源:IndexedStore.java


注:本文中的org.elasticsearch.index.query.QueryBuilders.regexpQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。