當前位置: 首頁>>代碼示例>>Java>>正文


Java QueryBuilders.wildcardQuery方法代碼示例

本文整理匯總了Java中org.elasticsearch.index.query.QueryBuilders.wildcardQuery方法的典型用法代碼示例。如果您正苦於以下問題:Java QueryBuilders.wildcardQuery方法的具體用法?Java QueryBuilders.wildcardQuery怎麽用?Java QueryBuilders.wildcardQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.index.query.QueryBuilders的用法示例。


在下文中一共展示了QueryBuilders.wildcardQuery方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: testForClient

import org.elasticsearch.index.query.QueryBuilders; //導入方法依賴的package包/類
@Test
public void testForClient() throws Exception {
    QueryBuilder qb = QueryBuilders.wildcardQuery("user", "k?mc*");
    client.prepareSearch().setQuery(qb).execute().actionGet();
}
 
開發者ID:felayman,項目名稱:elasticsearch-full,代碼行數:6,代碼來源:WildcardQueryDemo.java

示例3: wildCardTextQuerySingleField

import org.elasticsearch.index.query.QueryBuilders; //導入方法依賴的package包/類
/**
 * <p>e.g. "W?F*HW"
 * where "?" matches any character
 * where * matches zero or more characters</p>
 * <p>Note, avoid using terms which begin with a wildcard,
 * e.g. *foo</p>
 * @param textQuery
 * @param fieldName
 * @param start
 * @param count
 * @return
 * @see https://www.elastic.co/guide/en/elasticsearch/guide/current/_wildcard_and_regexp_queries.html
 */
public String wildCardTextQuerySingleField(String textQuery, String fieldName, int start, int count) {
	QueryBuilder qb  = QueryBuilders.wildcardQuery(fieldName, textQuery);
	SearchSourceBuilder ssb = new SearchSourceBuilder();
	ssb.query(qb);
	ssb.from(start);
	if (count > -1)
		ssb.size(count);
	return ssb.toString();
}
 
開發者ID:topicquests,項目名稱:backside-servlet-ks,代碼行數:23,代碼來源:ElasticQueryDSL.java


注:本文中的org.elasticsearch.index.query.QueryBuilders.wildcardQuery方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。