Package org.apache.lucene.search

Examples of org.apache.lucene.search.DefaultSimilarity


      //System.out.println(msg);
      lastScore = scores[i];
  }

  // override the norms to be inverted
  Similarity s = new DefaultSimilarity() {
    public float lengthNorm(String fieldName, int numTokens) {
        return numTokens;
    }
      };
  FieldNormModifier fnm = new FieldNormModifier(store, s);
View Full Code Here


      //System.out.println(msg);
      lastScore = scores[i];
  }

  // override the norms to be inverted
  Similarity s = new DefaultSimilarity() {
            @Override
            public float computeNorm(String fieldName, FieldInvertState state) {
              return state.getBoost() * (discountOverlaps ? state.getLength() - state.getNumOverlap() : state.getLength());
            }
          };
View Full Code Here

    /**
     * Constructor requiring an IndexReader.
     */
    public MoreLikeThis(IndexReader ir) {
        this(ir, new DefaultSimilarity());
    }
View Full Code Here

  public void testSpanScorerZeroSloppyFreq() throws Exception {
    boolean ordered = true;
    int slop = 1;

    final Similarity sim = new DefaultSimilarity() {
      @Override
      public float sloppyFreq(int distance) {
        return 0.0f;
      }
    };
View Full Code Here

 
  /**
   * Constructor requiring an IndexReader.
   */
  public MoreLikeThis(IndexReader ir) {
    this(ir, new DefaultSimilarity());
  }
View Full Code Here

            analyzer = new StandardAnalyzer(Version.LUCENE_35);
        }
        // Similarity from configuration:
        Similarity similarity = pluginRegistry.getBeanByFullPrefix(SENSEI_INDEX_SIMILARITY, Similarity.class);
        if (similarity == null) {
            similarity = new DefaultSimilarity();
        }
        ZoieConfig zoieConfig;
        if (_gateway != null) {
            zoieConfig = new ZoieConfig(_gateway.getVersionComparator());
        } else {
View Full Code Here

  public void testSpanScorerZeroSloppyFreq() throws Exception {
    boolean ordered = true;
    int slop = 1;

    final Similarity sim = new DefaultSimilarity() {
      @Override
      public float sloppyFreq(int distance) {
        return 0.0f;
      }
    };
View Full Code Here

      //System.out.println(msg);
      lastScore = scores[i];
  }

  // override the norms to be inverted
  Similarity s = new DefaultSimilarity() {
            @Override
            public float computeNorm(String fieldName, FieldInvertState state) {
              return state.getBoost() * (discountOverlaps ? state.getLength() - state.getNumOverlap() : state.getLength());
            }
          };
View Full Code Here

    }

    public void testRewriteCoord1() throws Exception {
      final Similarity oldSimilarity = s.getSimilarity();
      try {
        s.setSimilarity(new DefaultSimilarity() {
          @Override
          public float coord(int overlap, int maxOverlap) {
            return overlap / ((float)maxOverlap + 1);
          }
        });
View Full Code Here

    }
   
    public void testRewriteNegate() throws Exception {
      final Similarity oldSimilarity = s.getSimilarity();
      try {
        s.setSimilarity(new DefaultSimilarity() {
          @Override
          public float coord(int overlap, int maxOverlap) {
            return overlap / ((float)maxOverlap + 1);
          }
        });
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.DefaultSimilarity

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.