Examples of PayloadTermQuery


Examples of org.apache.lucene.search.payloads.PayloadTermQuery

      TopDocs topDocs = searcher.search(directQuery, 10);
      System.out.println("Number of matching docs: " + topDocs.totalHits);
      ScoreDoc doc1 = topDocs.scoreDocs[0];
      System.out.println("Doc: " + doc1.toString());
      System.out.println("Explain: " + searcher.explain(directQuery, doc1.doc));
      Query payloadQuery = new PayloadTermQuery(new Term("title", "London"), new MaxPayloadFunction());
      topDocs = searcher.search(payloadQuery, 10);
      System.out.println("Number of matching docs: " + topDocs.totalHits);
      ScoreDoc doc2 = topDocs.scoreDocs[0];
      System.out.println("Doc: " + doc2.toString());
      System.out.println("Explain: " + searcher.explain(payloadQuery, doc2.doc));
View Full Code Here

Examples of org.apache.lucene.search.payloads.PayloadTermQuery

  public SpanQuery getSpanQuery(Element e) throws ParserException
  {
     String fieldName=DOMUtils.getAttributeWithInheritanceOrFail(e,"fieldName");
     String value=DOMUtils.getNonBlankTextOrFail(e);
      PayloadTermQuery btq = new PayloadTermQuery(new Term(fieldName,value), new AveragePayloadFunction());

      btq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
    return btq;

  }
View Full Code Here

Examples of org.apache.lucene.search.payloads.PayloadTermQuery

        // check that this is done on a field that has payloads
        if (payloadFields.contains(term.field()) == false)
          return input;

        output = new PayloadTermQuery(term, func);
      }
      // rewrite PhraseQueries
      else if (input instanceof PhraseQuery) {
        PhraseQuery pin = (PhraseQuery) input;
        Term[] terms = pin.getTerms();
        int slop = pin.getSlop();
        boolean inorder = false;

        // check that this is done on a field that has payloads
        if (terms.length > 0
                && payloadFields.contains(terms[0].field()) == false)
          return input;

        SpanQuery[] clauses = new SpanQuery[terms.length];
        // phrase queries : keep the default function i.e. average
        for (int i = 0; i < terms.length; i++)
          clauses[i] = new PayloadTermQuery(terms[i], func);

        output = new PayloadNearQuery(clauses, slop, inorder);
      }
      // recursively rewrite DJMQs
      else if (input instanceof DisjunctionMaxQuery) {
View Full Code Here

Examples of org.apache.lucene.search.payloads.PayloadTermQuery

  @Override
  public SpanQuery getSpanQuery(Element e) throws ParserException {
    String fieldName = DOMUtils.getAttributeWithInheritanceOrFail(e, "fieldName");
    String value = DOMUtils.getNonBlankTextOrFail(e);

    PayloadTermQuery btq = new PayloadTermQuery(new Term(fieldName, value), new AveragePayloadFunction());
    btq.setBoost(DOMUtils.getAttribute(e, "boost", 1.0f));
    return btq;
  }
View Full Code Here

Examples of org.apache.lucene.search.payloads.PayloadTermQuery

          }
         
          // Now, add this topic to the list, if the score is nonzero
          if (score > 0.01f){
            //System.out.printf("Adding topic %d with score %f\n", k, score);
            PayloadTermQuery fsq1 = new PayloadTermQuery(new Term("topicspayload"+lda.scens.get(idx).K, "p"+k), new AveragePayloadFunction(), false);
            bquery.add(fsq1, Occur.SHOULD);           
            queryOpt[k] = score;
          }
        }
       
View Full Code Here

Examples of org.apache.lucene.search.payloads.PayloadTermQuery

  public SpanQuery getSpanQuery(Element e) throws ParserException
  {
     String fieldName=DOMUtils.getAttributeWithInheritanceOrFail(e,"fieldName");
     String value=DOMUtils.getNonBlankTextOrFail(e);
      PayloadTermQuery btq = new PayloadTermQuery(new Term(fieldName,value), new AveragePayloadFunction());

      btq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
    return btq;

  }
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.