Examples of mustNot()


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

          }
          else { // need to exclude types or sources
            BoolFilterBuilder typesNotSources = FilterBuilders.boolFilter();
            BoolFilterBuilder tagsAndNothingElse = typesNotSources.must(FilterBuilders.termsFilter(DocumentPojo.tags_, invTagEl.getValue().toArray()));
            if (null != score.sourceWeights) {
              tagsAndNothingElse = tagsAndNothingElse.mustNot(FilterBuilders.termsFilter(DocumentPojo.sourceKey_, score.sourceWeights.keySet().toArray()));
            }
            if (null != score.typeWeights) {
              tagsAndNothingElse = tagsAndNothingElse.mustNot(FilterBuilders.termsFilter(DocumentPojo.mediaType_, score.typeWeights.keySet().toArray()));
            }
            manualWeights.add(tagsAndNothingElse, invTagEl.getKey());
View Full Code Here

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

            BoolFilterBuilder tagsAndNothingElse = typesNotSources.must(FilterBuilders.termsFilter(DocumentPojo.tags_, invTagEl.getValue().toArray()));
            if (null != score.sourceWeights) {
              tagsAndNothingElse = tagsAndNothingElse.mustNot(FilterBuilders.termsFilter(DocumentPojo.sourceKey_, score.sourceWeights.keySet().toArray()));
            }
            if (null != score.typeWeights) {
              tagsAndNothingElse = tagsAndNothingElse.mustNot(FilterBuilders.termsFilter(DocumentPojo.mediaType_, score.typeWeights.keySet().toArray()));
            }
            manualWeights.add(tagsAndNothingElse, invTagEl.getKey());
          }
        }
      }//TESTED
View Full Code Here

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

                        return;
                    }

                    // exclude myself
                    Term uidTerm = docMapper.uidMapper().term(request.type(), request.id());
                    boolBuilder.mustNot(termQuery(uidTerm.field(), uidTerm.text()));
                } catch (Exception e) {
                    listener.onFailure(e);
                    return;
                }
View Full Code Here

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

      for (QueryBuilder qb : shouldQueryBuilderList) {
        query.should(qb);
      }
      for (QueryBuilder qb : mustNotQueryBuilderList) {
        query.mustNot(qb);
      }
      for (QueryBuilder qb : mustQueryBuilderList) {
        query.must(qb);
      }
    }
View Full Code Here

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

                    }

                    // exclude myself
                    if (!request.include()) {
                        Term uidTerm = docMapper.uidMapper().term(request.type(), request.id());
                        boolBuilder.mustNot(termQuery(uidTerm.field(), uidTerm.text()));
                        boolBuilder.adjustPureNegative(false);
                    }
                } catch (Throwable e) {
                    listener.onFailure(e);
                    return;
View Full Code Here

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

    // Negative terms
    if (negativeSearchTerms != null) {
      for (Map.Entry<String, Set<Object>> entry : negativeSearchTerms.entrySet()) {
        Set<Object> values = entry.getValue();
        if (values.size() == 1)
          booleanQuery.mustNot(new TermsQueryBuilder(entry.getKey(), values.iterator().next()));
        else
          booleanQuery.mustNot(new TermsQueryBuilder(entry.getKey(), values.toArray(new String[values.size()])));
      }
      this.queryBuilder = booleanQuery;
    }
View Full Code Here

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

      for (Map.Entry<String, Set<Object>> entry : negativeSearchTerms.entrySet()) {
        Set<Object> values = entry.getValue();
        if (values.size() == 1)
          booleanQuery.mustNot(new TermsQueryBuilder(entry.getKey(), values.iterator().next()));
        else
          booleanQuery.mustNot(new TermsQueryBuilder(entry.getKey(), values.toArray(new String[values.size()])));
      }
      this.queryBuilder = booleanQuery;
    }

    // Date ranges
View Full Code Here

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

        while (chainIterator.hasNext()) {
            Criteria chainedCriteria = chainIterator.next();
            if(chainedCriteria.isOr()){
                query.should(createQueryFragmentForCriteria(chainedCriteria));
            }else if(chainedCriteria.isNegating()){
                query.mustNot(createQueryFragmentForCriteria(chainedCriteria));
            }else{
                query.must(createQueryFragmentForCriteria(chainedCriteria));
            }
        }
        return query;
View Full Code Here

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

    }

    private QueryBuilder buildNegationQuery(String fieldName, Iterator<Criteria.CriteriaEntry> it){
        BoolQueryBuilder notQuery =  boolQuery();
        while (it.hasNext()){
            notQuery.mustNot(fieldQuery(fieldName, it.next().getValue()));
        }
        return notQuery;
    }

    private void addBoost(QueryBuilder query, float boost){
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.