Search in sources :

Example 61 with QueryBuilder

use of org.elasticsearch.index.query.QueryBuilder in project fess by codelibs.

the class EsAbstractConditionQuery method regRangeQ.

protected RangeQueryBuilder regRangeQ(String name, ConditionKey ck, Object value) {
    checkEsInvalidQuery(name, value);
    assertObjectNotNull("ck", ck);
    if (queryBuilderList != null) {
        for (QueryBuilder builder : queryBuilderList) {
            if (builder instanceof RangeQueryBuilder) {
                RangeQueryBuilder rangeQueryBuilder = (RangeQueryBuilder) builder;
                if (rangeQueryBuilder.toString().replaceAll("\\s", "").startsWith("{\"range\":{\"" + name + "\"")) {
                    addRangeC(rangeQueryBuilder, ck, value);
                    return rangeQueryBuilder;
                }
            }
        }
    }
    RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery(name);
    addRangeC(rangeQueryBuilder, ck, value);
    regQ(rangeQueryBuilder);
    return rangeQueryBuilder;
}
Also used : IdsQueryBuilder(org.elasticsearch.index.query.IdsQueryBuilder) MatchQueryBuilder(org.elasticsearch.index.query.MatchQueryBuilder) RegexpQueryBuilder(org.elasticsearch.index.query.RegexpQueryBuilder) PrefixQueryBuilder(org.elasticsearch.index.query.PrefixQueryBuilder) QueryStringQueryBuilder(org.elasticsearch.index.query.QueryStringQueryBuilder) TermsQueryBuilder(org.elasticsearch.index.query.TermsQueryBuilder) MatchPhrasePrefixQueryBuilder(org.elasticsearch.index.query.MatchPhrasePrefixQueryBuilder) CommonTermsQueryBuilder(org.elasticsearch.index.query.CommonTermsQueryBuilder) FunctionScoreQueryBuilder(org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder) SpanTermQueryBuilder(org.elasticsearch.index.query.SpanTermQueryBuilder) MoreLikeThisQueryBuilder(org.elasticsearch.index.query.MoreLikeThisQueryBuilder) QueryBuilder(org.elasticsearch.index.query.QueryBuilder) RangeQueryBuilder(org.elasticsearch.index.query.RangeQueryBuilder) WildcardQueryBuilder(org.elasticsearch.index.query.WildcardQueryBuilder) ExistsQueryBuilder(org.elasticsearch.index.query.ExistsQueryBuilder) TermQueryBuilder(org.elasticsearch.index.query.TermQueryBuilder) MatchPhraseQueryBuilder(org.elasticsearch.index.query.MatchPhraseQueryBuilder) MatchAllQueryBuilder(org.elasticsearch.index.query.MatchAllQueryBuilder) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder) RangeQueryBuilder(org.elasticsearch.index.query.RangeQueryBuilder)

Example 62 with QueryBuilder

use of org.elasticsearch.index.query.QueryBuilder in project fess by codelibs.

the class BsSearchLogCB method build.

// ===================================================================================
//                                                                               Build
//                                                                               =====
@Override
public SearchRequestBuilder build(SearchRequestBuilder builder) {
    if (_conditionQuery != null) {
        QueryBuilder queryBuilder = _conditionQuery.getQuery();
        if (queryBuilder != null) {
            builder.setQuery(queryBuilder);
        }
        _conditionQuery.getFieldSortBuilderList().forEach(sort -> {
            builder.addSort(sort);
        });
    }
    if (_conditionAggregation != null) {
        _conditionAggregation.getAggregationBuilderList().forEach(builder::addAggregation);
    }
    if (_specification != null) {
        builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
    }
    return builder;
}
Also used : QueryBuilder(org.elasticsearch.index.query.QueryBuilder)

Example 63 with QueryBuilder

use of org.elasticsearch.index.query.QueryBuilder in project fess by codelibs.

the class BsClickLogCB method build.

// ===================================================================================
//                                                                               Build
//                                                                               =====
@Override
public SearchRequestBuilder build(SearchRequestBuilder builder) {
    if (_conditionQuery != null) {
        QueryBuilder queryBuilder = _conditionQuery.getQuery();
        if (queryBuilder != null) {
            builder.setQuery(queryBuilder);
        }
        _conditionQuery.getFieldSortBuilderList().forEach(sort -> {
            builder.addSort(sort);
        });
    }
    if (_conditionAggregation != null) {
        _conditionAggregation.getAggregationBuilderList().forEach(builder::addAggregation);
    }
    if (_specification != null) {
        builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
    }
    return builder;
}
Also used : QueryBuilder(org.elasticsearch.index.query.QueryBuilder)

Example 64 with QueryBuilder

use of org.elasticsearch.index.query.QueryBuilder in project fess by codelibs.

the class BsFavoriteLogCB method build.

// ===================================================================================
//                                                                               Build
//                                                                               =====
@Override
public SearchRequestBuilder build(SearchRequestBuilder builder) {
    if (_conditionQuery != null) {
        QueryBuilder queryBuilder = _conditionQuery.getQuery();
        if (queryBuilder != null) {
            builder.setQuery(queryBuilder);
        }
        _conditionQuery.getFieldSortBuilderList().forEach(sort -> {
            builder.addSort(sort);
        });
    }
    if (_conditionAggregation != null) {
        _conditionAggregation.getAggregationBuilderList().forEach(builder::addAggregation);
    }
    if (_specification != null) {
        builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
    }
    return builder;
}
Also used : QueryBuilder(org.elasticsearch.index.query.QueryBuilder)

Example 65 with QueryBuilder

use of org.elasticsearch.index.query.QueryBuilder in project fess by codelibs.

the class BsSearchFieldLogCB method build.

// ===================================================================================
//                                                                               Build
//                                                                               =====
@Override
public SearchRequestBuilder build(SearchRequestBuilder builder) {
    if (_conditionQuery != null) {
        QueryBuilder queryBuilder = _conditionQuery.getQuery();
        if (queryBuilder != null) {
            builder.setQuery(queryBuilder);
        }
        _conditionQuery.getFieldSortBuilderList().forEach(sort -> {
            builder.addSort(sort);
        });
    }
    if (_conditionAggregation != null) {
        _conditionAggregation.getAggregationBuilderList().forEach(builder::addAggregation);
    }
    if (_specification != null) {
        builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
    }
    return builder;
}
Also used : QueryBuilder(org.elasticsearch.index.query.QueryBuilder)

Aggregations

QueryBuilder (org.elasticsearch.index.query.QueryBuilder)161 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)51 SearchResponse (org.elasticsearch.action.search.SearchResponse)32 MatchAllQueryBuilder (org.elasticsearch.index.query.MatchAllQueryBuilder)25 Map (java.util.Map)22 ArrayList (java.util.ArrayList)19 AbstractQueryBuilder (org.elasticsearch.index.query.AbstractQueryBuilder)19 RangeQueryBuilder (org.elasticsearch.index.query.RangeQueryBuilder)19 MatchQueryBuilder (org.elasticsearch.index.query.MatchQueryBuilder)18 HashMap (java.util.HashMap)16 SearchRequestBuilder (org.elasticsearch.action.search.SearchRequestBuilder)16 IndexRequestBuilder (org.elasticsearch.action.index.IndexRequestBuilder)14 HasParentQueryBuilder (org.elasticsearch.index.query.HasParentQueryBuilder)14 TermQueryBuilder (org.elasticsearch.index.query.TermQueryBuilder)14 FunctionScoreQueryBuilder (org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder)14 IOException (java.io.IOException)12 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)12 MultiSearchResponse (org.elasticsearch.action.search.MultiSearchResponse)11 XContentParser (org.elasticsearch.common.xcontent.XContentParser)11 BytesRef (org.apache.lucene.util.BytesRef)10