Package org.apache.lucene.search.Explanation

Examples of org.apache.lucene.search.Explanation.IDFExplanation


    @Override public float tf(float freq) { return freq; }
    @Override public float sloppyFreq(int distance) { return 2.0f; }
    @Override public float idf(int docFreq, int numDocs) { return 1.0f; }
    @Override public float coord(int overlap, int maxOverlap) { return 1.0f; }
    @Override public IDFExplanation idfExplain(Collection<Term> terms, Searcher searcher) throws IOException {
      return new IDFExplanation() {
        @Override
        public float getIdf() {
          return 1.0f;
        }
        @Override
View Full Code Here


    }

    public IDFExplanation idfExplain(final Collection<Term> terms,
                                     final Searcher searcher)
    {
        return new IDFExplanation() {
            public float getIdf()
            {
                return idfTerms(terms, searcher);
            }
View Full Code Here

    @Override public float tf(float freq) {
      return 1.0f;
    }
    // idf used for phrase queries
    @Override public IDFExplanation idfExplain(Collection<Term> terms, Searcher searcher) throws IOException {
      return new IDFExplanation() {
        @Override
        public float getIdf() {
          return 1.0f;
        }
        @Override
View Full Code Here

    }

    public IDFExplanation idfExplain(final Collection<Term> terms,
                                     final Searcher searcher)
    {
        return new IDFExplanation() {
            public float getIdf()
            {
                return idfTerms(terms, searcher);
            }
View Full Code Here

    @Override public float tf(float freq) { return freq; }
    @Override public float sloppyFreq(int distance) { return 2.0f; }
    @Override public float idf(int docFreq, int numDocs) { return 1.0f; }
    @Override public float coord(int overlap, int maxOverlap) { return 1.0f; }
    @Override public IDFExplanation idfExplain(Collection<Term> terms, Searcher searcher) throws IOException {
      return new IDFExplanation() {
        @Override
        public float getIdf() {
          return 1.0f;
        }
        @Override
View Full Code Here

   * @throws IOException
   */
  public IDFExplanation idfExplain(final Term term, final Searcher searcher) throws IOException {
    if(supportedMethods.overridesTermIDF) {
      final float idf = idf(term, searcher);
      return new IDFExplanation() {
        //@Override
        public float getIdf() {
          return idf;
        }
        //@Override
        public String explain() {
          return "Inexplicable";
        }
      };
    }
    final int df = searcher.docFreq(term);
    final int max = searcher.maxDoc();
    final float idf = idf(df, max);
    return new IDFExplanation() {
        //@Override
        public String explain() {
          return "idf(docFreq=" + df +
          ", maxDocs=" + max + ")";
        }
View Full Code Here

   * @throws IOException
   */
  public IDFExplanation idfExplain(Collection terms, Searcher searcher) throws IOException {
    if(supportedMethods.overridesCollectionIDF) {
      final float idf = idf(terms, searcher);
      return new IDFExplanation() {
        //@Override
        public float getIdf() {
          return idf;
        }
        //@Override
        public String explain() {
          return "Inexplicable";
        }
      };
    }
    final int max = searcher.maxDoc();
    float idf = 0.0f;
    final StringBuffer exp = new StringBuffer();
    Iterator i = terms.iterator();
    while (i.hasNext()) {
      Term term = (Term)i.next();
      final int df = searcher.docFreq(term);
      idf += idf(df, max);
      exp.append(" ");
      exp.append(term.text());
      exp.append("=");
      exp.append(df);
    }
    final float fIdf = idf;
    return new IDFExplanation() {
      //@Override
      public float getIdf() {
        return fIdf;
      }
      //@Override
View Full Code Here

    @Override public float tf(float freq) { return freq; }
    @Override public float sloppyFreq(int distance) { return 2.0f; }
    @Override public float idf(int docFreq, int numDocs) { return 1.0f; }
    @Override public float coord(int overlap, int maxOverlap) { return 1.0f; }
    @Override public IDFExplanation idfExplain(Collection<Term> terms, Searcher searcher) throws IOException {
      return new IDFExplanation() {
        @Override
        public float getIdf() {
          return 1.0f;
        }
        @Override
View Full Code Here

      return idfExplain(term, searcher);
    }
    final int df = docFreq;
    final int max = searcher.maxDoc();
    final float idf = idf(df, max);
    return new IDFExplanation() {
        @Override
        public String explain() {
          return "idf(docFreq=" + df +
          ", maxDocs=" + max + ")";
        }
View Full Code Here

      exp.append(term.text());
      exp.append("=");
      exp.append(df);
    }
    final float fIdf = idf;
    return new IDFExplanation() {
      @Override
      public float getIdf() {
        return fIdf;
      }
      @Override
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.Explanation.IDFExplanation

Copyright © 2018 www.massapicom. 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.