Search in sources :

Example 81 with BoolQueryBuilder

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

the class BsRoleTypeCQ method bool.

public void bool(BoolCall<RoleTypeCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
    RoleTypeCQ mustQuery = new RoleTypeCQ();
    RoleTypeCQ shouldQuery = new RoleTypeCQ();
    RoleTypeCQ mustNotQuery = new RoleTypeCQ();
    RoleTypeCQ filterQuery = new RoleTypeCQ();
    boolLambda.callback(mustQuery, shouldQuery, mustNotQuery, filterQuery);
    if (mustQuery.hasQueries() || shouldQuery.hasQueries() || mustNotQuery.hasQueries() || filterQuery.hasQueries()) {
        BoolQueryBuilder builder = regBoolCQ(mustQuery.getQueryBuilderList(), shouldQuery.getQueryBuilderList(), mustNotQuery.getQueryBuilderList(), filterQuery.getQueryBuilderList());
        if (opLambda != null) {
            opLambda.callback(builder);
        }
    }
}
Also used : RoleTypeCQ(org.codelibs.fess.es.config.cbean.cq.RoleTypeCQ) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder)

Example 82 with BoolQueryBuilder

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

the class SuggestHelper method purgeDocumentSuggest.

public void purgeDocumentSuggest(final LocalDateTime time) {
    final BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
    boolQueryBuilder.must(QueryBuilders.rangeQuery(FieldNames.TIMESTAMP).lt(time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
    boolQueryBuilder.must(QueryBuilders.termQuery(FieldNames.KINDS, SuggestItem.Kind.DOCUMENT.toString()));
    boolQueryBuilder.mustNot(QueryBuilders.termQuery(FieldNames.KINDS, SuggestItem.Kind.QUERY.toString()));
    boolQueryBuilder.mustNot(QueryBuilders.termQuery(FieldNames.KINDS, SuggestItem.Kind.USER.toString()));
    SuggestUtil.deleteByQuery(fessEsClient, suggester.getIndex(), suggester.getType(), boolQueryBuilder);
}
Also used : BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder)

Example 83 with BoolQueryBuilder

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

the class BsCrawlingInfoCQ method bool.

public void bool(BoolCall<CrawlingInfoCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
    CrawlingInfoCQ mustQuery = new CrawlingInfoCQ();
    CrawlingInfoCQ shouldQuery = new CrawlingInfoCQ();
    CrawlingInfoCQ mustNotQuery = new CrawlingInfoCQ();
    CrawlingInfoCQ filterQuery = new CrawlingInfoCQ();
    boolLambda.callback(mustQuery, shouldQuery, mustNotQuery, filterQuery);
    if (mustQuery.hasQueries() || shouldQuery.hasQueries() || mustNotQuery.hasQueries() || filterQuery.hasQueries()) {
        BoolQueryBuilder builder = regBoolCQ(mustQuery.getQueryBuilderList(), shouldQuery.getQueryBuilderList(), mustNotQuery.getQueryBuilderList(), filterQuery.getQueryBuilderList());
        if (opLambda != null) {
            opLambda.callback(builder);
        }
    }
}
Also used : CrawlingInfoCQ(org.codelibs.fess.es.config.cbean.cq.CrawlingInfoCQ) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder)

Example 84 with BoolQueryBuilder

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

the class BsDataConfigToLabelCQ method bool.

public void bool(BoolCall<DataConfigToLabelCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
    DataConfigToLabelCQ mustQuery = new DataConfigToLabelCQ();
    DataConfigToLabelCQ shouldQuery = new DataConfigToLabelCQ();
    DataConfigToLabelCQ mustNotQuery = new DataConfigToLabelCQ();
    DataConfigToLabelCQ filterQuery = new DataConfigToLabelCQ();
    boolLambda.callback(mustQuery, shouldQuery, mustNotQuery, filterQuery);
    if (mustQuery.hasQueries() || shouldQuery.hasQueries() || mustNotQuery.hasQueries() || filterQuery.hasQueries()) {
        BoolQueryBuilder builder = regBoolCQ(mustQuery.getQueryBuilderList(), shouldQuery.getQueryBuilderList(), mustNotQuery.getQueryBuilderList(), filterQuery.getQueryBuilderList());
        if (opLambda != null) {
            opLambda.callback(builder);
        }
    }
}
Also used : BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder) DataConfigToLabelCQ(org.codelibs.fess.es.config.cbean.cq.DataConfigToLabelCQ)

Example 85 with BoolQueryBuilder

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

the class BsElevateWordToLabelCQ method bool.

public void bool(BoolCall<ElevateWordToLabelCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
    ElevateWordToLabelCQ mustQuery = new ElevateWordToLabelCQ();
    ElevateWordToLabelCQ shouldQuery = new ElevateWordToLabelCQ();
    ElevateWordToLabelCQ mustNotQuery = new ElevateWordToLabelCQ();
    ElevateWordToLabelCQ filterQuery = new ElevateWordToLabelCQ();
    boolLambda.callback(mustQuery, shouldQuery, mustNotQuery, filterQuery);
    if (mustQuery.hasQueries() || shouldQuery.hasQueries() || mustNotQuery.hasQueries() || filterQuery.hasQueries()) {
        BoolQueryBuilder builder = regBoolCQ(mustQuery.getQueryBuilderList(), shouldQuery.getQueryBuilderList(), mustNotQuery.getQueryBuilderList(), filterQuery.getQueryBuilderList());
        if (opLambda != null) {
            opLambda.callback(builder);
        }
    }
}
Also used : BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder) ElevateWordToLabelCQ(org.codelibs.fess.es.config.cbean.cq.ElevateWordToLabelCQ)

Aggregations

BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)98 QueryBuilder (org.elasticsearch.index.query.QueryBuilder)25 SearchResponse (org.elasticsearch.action.search.SearchResponse)15 SearchRequestBuilder (org.elasticsearch.action.search.SearchRequestBuilder)9 MatchQueryBuilder (org.elasticsearch.index.query.MatchQueryBuilder)9 HasParentQueryBuilder (org.elasticsearch.index.query.HasParentQueryBuilder)8 ElasticsearchAssertions.assertSearchResponse (org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse)7 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 List (java.util.List)5 MatchAllQueryBuilder (org.elasticsearch.index.query.MatchAllQueryBuilder)5 RangeQueryBuilder (org.elasticsearch.index.query.RangeQueryBuilder)5 Map (java.util.Map)4 AbstractAggregationBuilder (org.elasticsearch.search.aggregations.AbstractAggregationBuilder)4 FilterAggregationBuilder (org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder)4 FieldSortBuilder (org.elasticsearch.search.sort.FieldSortBuilder)4 Matchers.containsString (org.hamcrest.Matchers.containsString)4 StickyFacetBuilder (org.sonar.server.es.StickyFacetBuilder)4 HasChildQueryBuilder (org.elasticsearch.index.query.HasChildQueryBuilder)3 InnerHitBuilder (org.elasticsearch.index.query.InnerHitBuilder)3