Search in sources :

Example 1 with QueryBuilder

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

the class BsBoostDocumentRuleCB 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.opensearch.index.query.QueryBuilder)

Example 2 with QueryBuilder

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

the class BsCrawlingInfoParamCB 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.opensearch.index.query.QueryBuilder)

Example 3 with QueryBuilder

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

the class BsElevateWordToLabelCB 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.opensearch.index.query.QueryBuilder)

Example 4 with QueryBuilder

use of org.opensearch.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 : RegexpQueryBuilder(org.opensearch.index.query.RegexpQueryBuilder) PrefixQueryBuilder(org.opensearch.index.query.PrefixQueryBuilder) SpanTermQueryBuilder(org.opensearch.index.query.SpanTermQueryBuilder) MatchPhraseQueryBuilder(org.opensearch.index.query.MatchPhraseQueryBuilder) ExistsQueryBuilder(org.opensearch.index.query.ExistsQueryBuilder) IdsQueryBuilder(org.opensearch.index.query.IdsQueryBuilder) RangeQueryBuilder(org.opensearch.index.query.RangeQueryBuilder) TermQueryBuilder(org.opensearch.index.query.TermQueryBuilder) MatchPhrasePrefixQueryBuilder(org.opensearch.index.query.MatchPhrasePrefixQueryBuilder) WildcardQueryBuilder(org.opensearch.index.query.WildcardQueryBuilder) QueryStringQueryBuilder(org.opensearch.index.query.QueryStringQueryBuilder) QueryBuilder(org.opensearch.index.query.QueryBuilder) TermsQueryBuilder(org.opensearch.index.query.TermsQueryBuilder) MatchQueryBuilder(org.opensearch.index.query.MatchQueryBuilder) MatchAllQueryBuilder(org.opensearch.index.query.MatchAllQueryBuilder) FunctionScoreQueryBuilder(org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder) MoreLikeThisQueryBuilder(org.opensearch.index.query.MoreLikeThisQueryBuilder) CommonTermsQueryBuilder(org.opensearch.index.query.CommonTermsQueryBuilder) BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder) RangeQueryBuilder(org.opensearch.index.query.RangeQueryBuilder)

Example 5 with QueryBuilder

use of org.opensearch.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 : RegexpQueryBuilder(org.opensearch.index.query.RegexpQueryBuilder) PrefixQueryBuilder(org.opensearch.index.query.PrefixQueryBuilder) SpanTermQueryBuilder(org.opensearch.index.query.SpanTermQueryBuilder) MatchPhraseQueryBuilder(org.opensearch.index.query.MatchPhraseQueryBuilder) ExistsQueryBuilder(org.opensearch.index.query.ExistsQueryBuilder) IdsQueryBuilder(org.opensearch.index.query.IdsQueryBuilder) RangeQueryBuilder(org.opensearch.index.query.RangeQueryBuilder) TermQueryBuilder(org.opensearch.index.query.TermQueryBuilder) MatchPhrasePrefixQueryBuilder(org.opensearch.index.query.MatchPhrasePrefixQueryBuilder) WildcardQueryBuilder(org.opensearch.index.query.WildcardQueryBuilder) QueryStringQueryBuilder(org.opensearch.index.query.QueryStringQueryBuilder) QueryBuilder(org.opensearch.index.query.QueryBuilder) TermsQueryBuilder(org.opensearch.index.query.TermsQueryBuilder) MatchQueryBuilder(org.opensearch.index.query.MatchQueryBuilder) MatchAllQueryBuilder(org.opensearch.index.query.MatchAllQueryBuilder) FunctionScoreQueryBuilder(org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder) MoreLikeThisQueryBuilder(org.opensearch.index.query.MoreLikeThisQueryBuilder) CommonTermsQueryBuilder(org.opensearch.index.query.CommonTermsQueryBuilder) BoolQueryBuilder(org.opensearch.index.query.BoolQueryBuilder) RangeQueryBuilder(org.opensearch.index.query.RangeQueryBuilder)

Aggregations

QueryBuilder (org.opensearch.index.query.QueryBuilder)47 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)11 SearchEngineClient (org.codelibs.fess.es.client.SearchEngineClient)6 BoolQueryBuilder (org.opensearch.index.query.BoolQueryBuilder)6 Map (java.util.Map)5 LogManager (org.apache.logging.log4j.LogManager)4 Logger (org.apache.logging.log4j.Logger)4 StringUtil (org.codelibs.core.lang.StringUtil)4 Constants (org.codelibs.fess.Constants)4 MatchPhraseQueryBuilder (org.opensearch.index.query.MatchPhraseQueryBuilder)4 PrefixQueryBuilder (org.opensearch.index.query.PrefixQueryBuilder)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Resource (javax.annotation.Resource)3 ComponentUtil (org.codelibs.fess.util.ComponentUtil)3 QueryBuilders (org.opensearch.index.query.QueryBuilders)3 HashMap (java.util.HashMap)2 Consumer (java.util.function.Consumer)2 PostConstruct (javax.annotation.PostConstruct)2 Tuple3 (org.codelibs.core.misc.Tuple3)2