本文整理汇总了Java中org.elasticsearch.index.query.WildcardQueryBuilder类的典型用法代码示例。如果您正苦于以下问题:Java WildcardQueryBuilder类的具体用法?Java WildcardQueryBuilder怎么用?Java WildcardQueryBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WildcardQueryBuilder类属于org.elasticsearch.index.query包,在下文中一共展示了WildcardQueryBuilder类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testBuildSimpleEqualsWildcardExpression
import org.elasticsearch.index.query.WildcardQueryBuilder; //导入依赖的package包/类
/**
* Tests {@link ElasticsearchQueryBuilderVisitor#buildSimpleExpression(PrimitiveStatement)} for the case where
* we're building a {@link ConditionType#EQUALS} expression with a prefix wildcard.
*/
@SuppressWarnings("unchecked")
@Test
public void testBuildSimpleEqualsWildcardExpression() throws Exception {
final Object value = "hello*";
final String property = "property";
doReturn(value).when(classValue).getValue();
doReturn(EQUALS).when(statement).getCondition();
doReturn(property).when(statement).getProperty();
assertThat(visitor.buildSimpleExpression(statement), instanceOf(WildcardQueryBuilder.class));
verify(visitor).buildSimpleExpression(statement);
verify(visitor).doGetPrimitiveFieldClass(statement);
verify(visitor).validateNotCollectionCheck(statement, classValue);
verify(visitor).createWildcardQuery(property, value.toString());
verify(visitor).getEnumSafeValue(classValue);
verify(statement).getProperty();
verify(statement).getCondition();
verifyNoMoreCollaboration();
}
开发者ID:8x8Cloud,项目名称:fiql-elasticsearch,代码行数:28,代码来源:ElasticsearchQueryBuilderVisitorTest.java
示例2: visit
import org.elasticsearch.index.query.WildcardQueryBuilder; //导入依赖的package包/类
@Override
public void visit( ContainsOperand op ) throws NoFullTextIndexException {
final String name = op.getProperty().getValue().toLowerCase();
final String value = op.getLiteral().getValue().toString().toLowerCase();
// or field is just a string that does need a prefix
if ( value.indexOf( "*" ) != -1 ) {
final WildcardQueryBuilder wildcardQuery =
QueryBuilders.wildcardQuery( IndexingUtils.FIELD_STRING_NESTED, value );
queryBuilders.push( fieldNameTerm( name, wildcardQuery ) );
}
else {
final MatchQueryBuilder termQuery = QueryBuilders.matchQuery( IndexingUtils.FIELD_STRING_NESTED, value );
queryBuilders.push( fieldNameTerm( name, termQuery ) );
}
//no op for filters, push an empty operation
//TODO, validate this works
filterBuilders.push( NoOpFilterBuilder.INSTANCE );
}
开发者ID:apache,项目名称:usergrid,代码行数:25,代码来源:EsQueryVistor.java
示例3: testBuildSimpleInequalityWildcardExpression
import org.elasticsearch.index.query.WildcardQueryBuilder; //导入依赖的package包/类
/**
* Tests {@link ElasticsearchQueryBuilderVisitor#buildSimpleExpression(PrimitiveStatement)} for the case where
* we're building a {@link ConditionType#NOT_EQUALS} expression with a prefix wildcard.
*/
@SuppressWarnings("unchecked")
@Test
public void testBuildSimpleInequalityWildcardExpression() throws Exception {
final Object value = "hello*";
final String property = "property";
doReturn(value).when(classValue).getValue();
doReturn(NOT_EQUALS).when(statement).getCondition();
doReturn(property).when(statement).getProperty();
assertThat(visitor.buildSimpleExpression(statement), instanceOf(BoolQueryBuilder.class));
verify(visitor).buildSimpleExpression(statement);
verify(visitor).doGetPrimitiveFieldClass(statement);
verify(visitor).validateNotCollectionCheck(statement, classValue);
verify(visitor).createBoolQueryBuilder();
verify(visitor).createWildcardQuery(property, value.toString());
verify(visitor).getEnumSafeValue(classValue);
verify(statement).getProperty();
verify(statement).getCondition();
verify(boolQueryBuilder).mustNot(any(WildcardQueryBuilder.class));
verifyNoMoreCollaboration();
}
开发者ID:8x8Cloud,项目名称:fiql-elasticsearch,代码行数:31,代码来源:ElasticsearchQueryBuilderVisitorTest.java
示例4: testCanMergeQueryPartsForNonRangeCurrentQueryPart
import org.elasticsearch.index.query.WildcardQueryBuilder; //导入依赖的package包/类
/**
* Tests {@link ElasticsearchQueryBuilderVisitor#canMergeQueryParts(QueryBuilder, QueryBuilder, ConditionType)} for
* the case where the current query part is not a {@link RangeQueryBuilder}. You might see this with something like
* an expression like {@code foo=le=300;foo==4}.
*/
@Test
public void testCanMergeQueryPartsForNonRangeCurrentQueryPart() throws Exception {
final RangeQueryBuilder previousPart = mock(RangeQueryBuilder.class);
final WildcardQueryBuilder currentPart = mock(WildcardQueryBuilder.class);
doReturn("taters").when(previousPart).fieldName();
doReturn("taters").when(currentPart).fieldName();
assertThat(visitor.canMergeQueryParts(previousPart, currentPart, ConditionType.AND), is(false));
}
开发者ID:8x8Cloud,项目名称:fiql-elasticsearch,代码行数:16,代码来源:ElasticsearchQueryBuilderVisitorTest.java
示例5: testCreateWildcardQuery
import org.elasticsearch.index.query.WildcardQueryBuilder; //导入依赖的package包/类
/**
* Tests {@link ElasticsearchQueryBuilderVisitor#createWildcardQuery(String, String)} (String, Object)} to make sure
* it does what we think it does.
*/
@Test
public void testCreateWildcardQuery() throws Exception {
doCallRealMethod().when(visitor).createWildcardQuery(anyString(), anyString());
final WildcardQueryBuilder queryBuilder = visitor.createWildcardQuery("fieldNameTaters", "tatersValue");
assertThat(queryBuilder.fieldName(), is("fieldNameTaters"));
assertThat(queryBuilder.value(), is("tatersValue"));
verify(visitor).createWildcardQuery("fieldNameTaters", "tatersValue");
verifyNoMoreCollaboration(visitor);
}
开发者ID:8x8Cloud,项目名称:fiql-elasticsearch,代码行数:18,代码来源:ElasticsearchQueryBuilderVisitorTest.java
示例6: registerQueryParsers
import org.elasticsearch.index.query.WildcardQueryBuilder; //导入依赖的package包/类
private void registerQueryParsers(List<SearchPlugin> plugins) {
registerQuery(new QuerySpec<>(MatchQueryBuilder.NAME, MatchQueryBuilder::new, MatchQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(MatchPhraseQueryBuilder.NAME, MatchPhraseQueryBuilder::new, MatchPhraseQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(MatchPhrasePrefixQueryBuilder.NAME, MatchPhrasePrefixQueryBuilder::new,
MatchPhrasePrefixQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(MultiMatchQueryBuilder.NAME, MultiMatchQueryBuilder::new, MultiMatchQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(NestedQueryBuilder.NAME, NestedQueryBuilder::new, NestedQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(HasChildQueryBuilder.NAME, HasChildQueryBuilder::new, HasChildQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(HasParentQueryBuilder.NAME, HasParentQueryBuilder::new, HasParentQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(DisMaxQueryBuilder.NAME, DisMaxQueryBuilder::new, DisMaxQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(IdsQueryBuilder.NAME, IdsQueryBuilder::new, IdsQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(MatchAllQueryBuilder.NAME, MatchAllQueryBuilder::new, MatchAllQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(QueryStringQueryBuilder.NAME, QueryStringQueryBuilder::new, QueryStringQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(BoostingQueryBuilder.NAME, BoostingQueryBuilder::new, BoostingQueryBuilder::fromXContent));
BooleanQuery.setMaxClauseCount(INDICES_MAX_CLAUSE_COUNT_SETTING.get(settings));
registerQuery(new QuerySpec<>(BoolQueryBuilder.NAME, BoolQueryBuilder::new, BoolQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(TermQueryBuilder.NAME, TermQueryBuilder::new, TermQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(TermsQueryBuilder.NAME, TermsQueryBuilder::new, TermsQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(FuzzyQueryBuilder.NAME, FuzzyQueryBuilder::new, FuzzyQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(RegexpQueryBuilder.NAME, RegexpQueryBuilder::new, RegexpQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(RangeQueryBuilder.NAME, RangeQueryBuilder::new, RangeQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(PrefixQueryBuilder.NAME, PrefixQueryBuilder::new, PrefixQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(WildcardQueryBuilder.NAME, WildcardQueryBuilder::new, WildcardQueryBuilder::fromXContent));
registerQuery(
new QuerySpec<>(ConstantScoreQueryBuilder.NAME, ConstantScoreQueryBuilder::new, ConstantScoreQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(SpanTermQueryBuilder.NAME, SpanTermQueryBuilder::new, SpanTermQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(SpanNotQueryBuilder.NAME, SpanNotQueryBuilder::new, SpanNotQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(SpanWithinQueryBuilder.NAME, SpanWithinQueryBuilder::new, SpanWithinQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(SpanContainingQueryBuilder.NAME, SpanContainingQueryBuilder::new,
SpanContainingQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(FieldMaskingSpanQueryBuilder.NAME, FieldMaskingSpanQueryBuilder::new,
FieldMaskingSpanQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(SpanFirstQueryBuilder.NAME, SpanFirstQueryBuilder::new, SpanFirstQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(SpanNearQueryBuilder.NAME, SpanNearQueryBuilder::new, SpanNearQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(SpanOrQueryBuilder.NAME, SpanOrQueryBuilder::new, SpanOrQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(MoreLikeThisQueryBuilder.NAME, MoreLikeThisQueryBuilder::new,
MoreLikeThisQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(WrapperQueryBuilder.NAME, WrapperQueryBuilder::new, WrapperQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(CommonTermsQueryBuilder.NAME, CommonTermsQueryBuilder::new, CommonTermsQueryBuilder::fromXContent));
registerQuery(
new QuerySpec<>(SpanMultiTermQueryBuilder.NAME, SpanMultiTermQueryBuilder::new, SpanMultiTermQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(FunctionScoreQueryBuilder.NAME, FunctionScoreQueryBuilder::new,
FunctionScoreQueryBuilder::fromXContent));
registerQuery(
new QuerySpec<>(SimpleQueryStringBuilder.NAME, SimpleQueryStringBuilder::new, SimpleQueryStringBuilder::fromXContent));
registerQuery(new QuerySpec<>(TypeQueryBuilder.NAME, TypeQueryBuilder::new, TypeQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(ScriptQueryBuilder.NAME, ScriptQueryBuilder::new, ScriptQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(GeoDistanceQueryBuilder.NAME, GeoDistanceQueryBuilder::new, GeoDistanceQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(GeoBoundingBoxQueryBuilder.NAME, GeoBoundingBoxQueryBuilder::new,
GeoBoundingBoxQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(GeoPolygonQueryBuilder.NAME, GeoPolygonQueryBuilder::new, GeoPolygonQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(ExistsQueryBuilder.NAME, ExistsQueryBuilder::new, ExistsQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(MatchNoneQueryBuilder.NAME, MatchNoneQueryBuilder::new, MatchNoneQueryBuilder::fromXContent));
registerQuery(new QuerySpec<>(ParentIdQueryBuilder.NAME, ParentIdQueryBuilder::new, ParentIdQueryBuilder::fromXContent));
if (ShapesAvailability.JTS_AVAILABLE && ShapesAvailability.SPATIAL4J_AVAILABLE) {
registerQuery(new QuerySpec<>(GeoShapeQueryBuilder.NAME, GeoShapeQueryBuilder::new, GeoShapeQueryBuilder::fromXContent));
}
registerFromPlugin(plugins, SearchPlugin::getQueries, this::registerQuery);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:62,代码来源:SearchModule.java
示例7: fullParamer
import org.elasticsearch.index.query.WildcardQueryBuilder; //导入依赖的package包/类
public static ToXContent fullParamer(WildcardQueryBuilder query, Paramer paramer) {
if (paramer.boost != null) {
query.boost(paramer.boost);
}
return query;
}
开发者ID:mazhou,项目名称:es-sql,代码行数:7,代码来源:Paramer.java
示例8: createWildcardQuery
import org.elasticsearch.index.query.WildcardQueryBuilder; //导入依赖的package包/类
/**
* Provides a test-friendly method for creating a {@link WildcardQueryBuilder} for building a string-based prefix
* wildcard query.
*
* @param propertyName The name of the property to match via the wildcard query.
* @param value The value of the prefix match.
* @return A {@link WildcardQueryBuilder} for querying via a prefix match.
*/
WildcardQueryBuilder createWildcardQuery(final String propertyName, final String value) {
return new WildcardQueryBuilder(propertyName, value);
}
开发者ID:8x8Cloud,项目名称:fiql-elasticsearch,代码行数:12,代码来源:ElasticsearchQueryBuilderVisitor.java
注:本文中的org.elasticsearch.index.query.WildcardQueryBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论