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


Java QueryBuilders.matchPhraseQuery方法代碼示例

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


在下文中一共展示了QueryBuilders.matchPhraseQuery方法的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: test

import org.elasticsearch.index.query.QueryBuilders; //導入方法依賴的package包/類
@Test
public void test() throws Exception {
    String key = "this is a";
    MatchPhraseQueryBuilder matchPhraseQueryBuilder = QueryBuilders.matchPhraseQuery("title",key);

    matchPhraseQueryBuilder.boost(10);
    matchPhraseQueryBuilder.analyzer("standard");
    matchPhraseQueryBuilder.slop(2);

       SearchResponse searchResponse = client.prepareSearch()
                .setIndices("my_index")
                .setTypes("my_type")
                .setQuery(matchPhraseQueryBuilder)
                .execute()
                .actionGet();
}
 
開發者ID:felayman,項目名稱:elasticsearch-full,代碼行數:17,代碼來源:MatchPhraseQueryDemo.java

示例3: fullTextQuerySingleField

import org.elasticsearch.index.query.QueryBuilders; //導入方法依賴的package包/類
public String fullTextQuerySingleField(String textQuery, boolean isPhraseQuery,
				String fieldName, int start, int count) {
	QueryBuilder qb;
	if (!isPhraseQuery)
		qb = QueryBuilders.matchQuery(fieldName, textQuery);
	else
		qb = QueryBuilders.matchPhraseQuery(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,代碼行數:16,代碼來源:ElasticQueryDSL.java


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