Examples of should()


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

        else if (AssociationPojo.docQuery_geo_index_ != sFieldName) { // (geo has no non-indexed form)
          String nonIndexField = (AssociationPojo.docQuery_entity1_index_ == sFieldName) ? AssociationPojo.docQuery_entity1_ : AssociationPojo.docQuery_entity2_;
          if (null == termBoolQ) {
            termBoolQ = QueryBuilders.boolQuery();
          }
          termQ = termBoolQ = termBoolQ.should(CrossVersionQueryBuilders.matchPhraseQuery(nonIndexField, dName));
          sQueryTerm.append(" OR ").append(nonIndexField).append(":\"").append(dName).append('"');         
        }//TESTED
      }
      //TESTED (entity+association) - entity options, add dname as exact text query
     
View Full Code Here

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

        if (null != masterAlias) {
          if (null == termBoolQ) {
            termBoolQ = QueryBuilders.boolQuery();
          }
          sQueryTerm.append(" OR ").append(sFieldName).append(":$manual_aliases");
          termBoolQ = termBoolQ.should(QueryBuilders.termQuery(sFieldName, qt.entity));
          termQ = termBoolQ = termBoolQ.should(QueryBuilders.termsQuery(sFieldName, masterAlias.getAlias().toArray()));

          // If want to add manual aliases as full text also...
          if ((null != qt.entityOpt) && qt.entityOpt.rawText) {
            if (null == this._extraFullTextTerms) {
View Full Code Here

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

          if (null == termBoolQ) {
            termBoolQ = QueryBuilders.boolQuery();
          }
          sQueryTerm.append(" OR ").append(sFieldName).append(":$manual_aliases");
          termBoolQ = termBoolQ.should(QueryBuilders.termQuery(sFieldName, qt.entity));
          termQ = termBoolQ = termBoolQ.should(QueryBuilders.termsQuery(sFieldName, masterAlias.getAlias().toArray()));

          // If want to add manual aliases as full text also...
          if ((null != qt.entityOpt) && qt.entityOpt.rawText) {
            if (null == this._extraFullTextTerms) {
              _extraFullTextTerms = new LinkedList<AdvancedQueryPojo.QueryTermPojo>();
View Full Code Here

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

                AdvancedQueryPojo.QueryTermPojo qtExtra = new AdvancedQueryPojo.QueryTermPojo();
                qtExtra.etext = dName;
                _extraFullTextTerms.add(qtExtra);
              }
              else if (null != nonIndexField) {
                termQ = termBoolQ = termBoolQ.should(CrossVersionQueryBuilders.matchPhraseQuery(nonIndexField, dName));
              }
            }
            if (EntityPojo.docQuery_index_ == sFieldName) { // (note: can use pointers here)
              sQueryTerm.append(" OR (($manual_aliases").append("))");
            }
View Full Code Here

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

                AdvancedQueryPojo.QueryTermPojo qtExtra = new AdvancedQueryPojo.QueryTermPojo();
                qtExtra.etext = textAlias;
                _extraFullTextTerms.add(qtExtra);
              }
              else if (null != nonIndexField) {             
                termQ = termBoolQ = termBoolQ.should(CrossVersionQueryBuilders.matchPhraseQuery(nonIndexField, textAlias));
              }
            }
            if (EntityPojo.docQuery_index_ == sFieldName) { // (note: can use pointers here)
              sQueryTerm.append(" OR (($manual_text_aliases").append("))");
            }
View Full Code Here

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

      // OK this one is a bit tricky because an event has a start+end time ... I think both
      // have to be inside the time range (fortunately because that's the easy case!)
      // (Note time_start and time_end don't exist inside the document object)
      StringBuffer sbDummy = new StringBuffer();
      BoolQueryBuilder combo2 = QueryBuilders.boolQuery();
      combo2.should(this.parseDateTerm(assoc.time, sQueryTerm, AssociationPojo.docQuery_time_start_, false));
      sQueryTerm.append(") OR/CONTAINS (");
      combo2.should(this.parseDateTerm(assoc.time, sQueryTerm, AssociationPojo.docQuery_time_end_, false));
      // (complex bit, start must be < and end must be >)
      BoolQueryBuilder combo3 = QueryBuilders.boolQuery();
      AdvancedQueryPojo.QueryTermPojo.TimeTermPojo event1 = new AdvancedQueryPojo.QueryTermPojo.TimeTermPojo();
View Full Code Here

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

      // (Note time_start and time_end don't exist inside the document object)
      StringBuffer sbDummy = new StringBuffer();
      BoolQueryBuilder combo2 = QueryBuilders.boolQuery();
      combo2.should(this.parseDateTerm(assoc.time, sQueryTerm, AssociationPojo.docQuery_time_start_, false));
      sQueryTerm.append(") OR/CONTAINS (");
      combo2.should(this.parseDateTerm(assoc.time, sQueryTerm, AssociationPojo.docQuery_time_end_, false));
      // (complex bit, start must be < and end must be >)
      BoolQueryBuilder combo3 = QueryBuilders.boolQuery();
      AdvancedQueryPojo.QueryTermPojo.TimeTermPojo event1 = new AdvancedQueryPojo.QueryTermPojo.TimeTermPojo();
      AdvancedQueryPojo.QueryTermPojo.TimeTermPojo event2 = new AdvancedQueryPojo.QueryTermPojo.TimeTermPojo();
      sQueryTerm.append("))");
View Full Code Here

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

        node.client().prepareIndex(INDEX, TYPE, article.getSlug()).setSource(data).execute().actionGet();
    }

    public List<Article> findBySlugAndText(String slug, String text) {
        BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
        boolQuery.should(QueryBuilders.textQuery("slug", slug));
        boolQuery.should(QueryBuilders.textQuery("text", text));

        SearchResponse searchResponse = node.client().prepareSearch(INDEX).setTypes(TYPE).
            addSort("dateCreated", SortOrder.DESC).
            setFilter(getNowDateFilter()).
View Full Code Here

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

    }

    public List<Article> findBySlugAndText(String slug, String text) {
        BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
        boolQuery.should(QueryBuilders.textQuery("slug", slug));
        boolQuery.should(QueryBuilders.textQuery("text", text));

        SearchResponse searchResponse = node.client().prepareSearch(INDEX).setTypes(TYPE).
            addSort("dateCreated", SortOrder.DESC).
            setFilter(getNowDateFilter()).
            setQuery(boolQuery).execute().actionGet();
View Full Code Here

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

    if (!shouldQueryBuilderList.isEmpty() || !mustNotQueryBuilderList.isEmpty() || !mustQueryBuilderList.isEmpty()) {

      query = boolQuery();

      for (QueryBuilder qb : shouldQueryBuilderList) {
        query.should(qb);
      }
      for (QueryBuilder qb : mustNotQueryBuilderList) {
        query.mustNot(qb);
      }
      for (QueryBuilder qb : mustQueryBuilderList) {
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.