Examples of must()


Examples of org.elasticsearch.index.query.BoolFilterBuilder.must()

    // No ES equivalent - hope this is done right inside
    //bq.setMaxClauseCount(1000000);
   
    // Add the empty-acl case
    BoolFilterBuilder subUnprotectedClause = new BoolFilterBuilder();
    subUnprotectedClause.must(allowOpen);
    subUnprotectedClause.must(denyOpen);
    bq.should(subUnprotectedClause);
    for (String accessToken : userAccessTokens)
    {
      bq.should(new TermFilterBuilder(allowField,accessToken));
View Full Code Here

Examples of org.elasticsearch.index.query.BoolFilterBuilder.must()

    //bq.setMaxClauseCount(1000000);
   
    // Add the empty-acl case
    BoolFilterBuilder subUnprotectedClause = new BoolFilterBuilder();
    subUnprotectedClause.must(allowOpen);
    subUnprotectedClause.must(denyOpen);
    bq.should(subUnprotectedClause);
    for (String accessToken : userAccessTokens)
    {
      bq.should(new TermFilterBuilder(allowField,accessToken));
      bq.mustNot(new TermFilterBuilder(denyField,accessToken));
View Full Code Here

Examples of org.elasticsearch.index.query.BoolFilterBuilder.must()

   
    if (null != entityTypeFilterStrings) {
      if ('-' != entityTypeFilterStrings[0].charAt(0)) { // (negative entity type, don't add to filter)
        outputFilter = FilterBuilders.boolFilter();
               
        outputFilter.must(FilterBuilders.nestedFilter(DocumentPojo.entities_,
            FilterBuilders.termsFilter(EntityPojo.docQuery_type_, entityTypeFilterStrings)));
      }
    }
    if (null != assocVerbFilterStrings) {
      if ('-' != assocVerbFilterStrings[0].charAt(0)) { // (negative verb, don't add to filter)
View Full Code Here

Examples of org.elasticsearch.index.query.BoolFilterBuilder.must()

          if (null == score.sourceWeights) { // Easy case
            manualWeights.add(FilterBuilders.termsFilter(DocumentPojo.mediaType_, invTypeEl.getValue().toArray()), invTypeEl.getKey());
          }
          else { // Need to filter out sources they are matched with higher prio
            BoolFilterBuilder typesNotSources = FilterBuilders.boolFilter();
            typesNotSources = typesNotSources.must(FilterBuilders.termsFilter(DocumentPojo.mediaType_, invTypeEl.getValue().toArray())).
                              mustNot(FilterBuilders.termsFilter(DocumentPojo.sourceKey_, score.sourceWeights.keySet().toArray()));
           
            manualWeights.add(typesNotSources, invTypeEl.getKey());
          }
        }
View Full Code Here

Examples of org.elasticsearch.index.query.BoolFilterBuilder.must()

      // Only open documents can be included.
      // That query is:
      // (fieldAllowShare is empty AND fieldDenyShare is empty AND fieldAllowDocument is empty AND fieldDenyDocument is empty)
      // We're trying to map to:  -(fieldAllowShare:*) , which should be pretty efficient in Solr because it is negated.  If this turns out not to be so, then we should
      // have the SolrConnector inject a special token into these fields when they otherwise would be empty, and we can trivially match on that token.
      bq.must(allowShareOpen);
      bq.must(denyShareOpen);
      bq.must(allowDocumentOpen);
      bq.must(denyDocumentOpen);
    }
    else
View Full Code Here

Examples of org.elasticsearch.index.query.BoolFilterBuilder.must()

      // That query is:
      // (fieldAllowShare is empty AND fieldDenyShare is empty AND fieldAllowDocument is empty AND fieldDenyDocument is empty)
      // We're trying to map to:  -(fieldAllowShare:*) , which should be pretty efficient in Solr because it is negated.  If this turns out not to be so, then we should
      // have the SolrConnector inject a special token into these fields when they otherwise would be empty, and we can trivially match on that token.
      bq.must(allowShareOpen);
      bq.must(denyShareOpen);
      bq.must(allowDocumentOpen);
      bq.must(denyDocumentOpen);
    }
    else
    {
View Full Code Here

Examples of org.elasticsearch.index.query.BoolFilterBuilder.must()

      // (fieldAllowShare is empty AND fieldDenyShare is empty AND fieldAllowDocument is empty AND fieldDenyDocument is empty)
      // We're trying to map to:  -(fieldAllowShare:*) , which should be pretty efficient in Solr because it is negated.  If this turns out not to be so, then we should
      // have the SolrConnector inject a special token into these fields when they otherwise would be empty, and we can trivially match on that token.
      bq.must(allowShareOpen);
      bq.must(denyShareOpen);
      bq.must(allowDocumentOpen);
      bq.must(denyDocumentOpen);
    }
    else
    {
      // Extend the query appropriately for each user access token.
View Full Code Here

Examples of org.elasticsearch.index.query.BoolFilterBuilder.must()

      // We're trying to map to:  -(fieldAllowShare:*) , which should be pretty efficient in Solr because it is negated.  If this turns out not to be so, then we should
      // have the SolrConnector inject a special token into these fields when they otherwise would be empty, and we can trivially match on that token.
      bq.must(allowShareOpen);
      bq.must(denyShareOpen);
      bq.must(allowDocumentOpen);
      bq.must(denyDocumentOpen);
    }
    else
    {
      // Extend the query appropriately for each user access token.
      bq.must(calculateCompleteSubquery(fieldAllowShare,fieldDenyShare,allowShareOpen,denyShareOpen,userAccessTokens));
View Full Code Here

Examples of org.elasticsearch.index.query.BoolQueryBuilder.must()

        WrapperQueryBuilder wrapper = new WrapperQueryBuilder("{ \"term\" : { \"field1\" : \"value1_1\" } }");
        SearchResponse searchResponse = client.prepareSearch().setQuery(wrapper).execute().actionGet();
        assertThat(searchResponse.hits().totalHits(), equalTo(1l));

        BoolQueryBuilder bool = new BoolQueryBuilder();
        bool.must(wrapper);
        bool.must(new TermQueryBuilder("field2", "value2_1"));

        searchResponse = client.prepareSearch().setQuery(wrapper).execute().actionGet();
        assertThat(searchResponse.hits().totalHits(), equalTo(1l));
View Full Code Here

Examples of org.elasticsearch.index.query.BoolQueryBuilder.must()

        SearchResponse searchResponse = client.prepareSearch().setQuery(wrapper).execute().actionGet();
        assertThat(searchResponse.hits().totalHits(), equalTo(1l));

        BoolQueryBuilder bool = new BoolQueryBuilder();
        bool.must(wrapper);
        bool.must(new TermQueryBuilder("field2", "value2_1"));

        searchResponse = client.prepareSearch().setQuery(wrapper).execute().actionGet();
        assertThat(searchResponse.hits().totalHits(), equalTo(1l));

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.