Examples of lengthNorm()


Examples of org.apache.lucene.search.Similarity.lengthNorm()

                   d.lengthNorm("foo",i-9), s.lengthNorm("foo",i),
                   0.0f);
    }
    for (int i = 8; i <=13; i++) {
      assertEquals("f: 8,13: spot i="+i,
                   1.0f, s.lengthNorm("bar",i),
                   0.0f);
    }
    for (int i = 6; i <=9; i++) {
      assertEquals("f: 6,9: spot i="+i,
                   1.0f, s.lengthNorm("yak",i),
View Full Code Here

Examples of org.apache.lucene.search.Similarity.lengthNorm()

                   1.0f, s.lengthNorm("bar",i),
                   0.0f);
    }
    for (int i = 6; i <=9; i++) {
      assertEquals("f: 6,9: spot i="+i,
                   1.0f, s.lengthNorm("yak",i),
                   0.0f);
    }
    for (int i = 13; i < 1000; i++) {
      assertEquals("f: 8,13: 13<x : i="+i,
                   d.lengthNorm("foo",i-12), s.lengthNorm("bar",i),
View Full Code Here

Examples of org.apache.lucene.search.Similarity.lengthNorm()

                   1.0f, s.lengthNorm("yak",i),
                   0.0f);
    }
    for (int i = 13; i < 1000; i++) {
      assertEquals("f: 8,13: 13<x : i="+i,
                   d.lengthNorm("foo",i-12), s.lengthNorm("bar",i),
                   0.0f);
    }
    for (int i = 9; i < 1000; i++) {
      assertEquals("f: 6,9: 9<x : i="+i,
                   d.lengthNorm("foo",i-8), s.lengthNorm("yak",i),
View Full Code Here

Examples of org.apache.lucene.search.Similarity.lengthNorm()

                   d.lengthNorm("foo",i-12), s.lengthNorm("bar",i),
                   0.0f);
    }
    for (int i = 9; i < 1000; i++) {
      assertEquals("f: 6,9: 9<x : i="+i,
                   d.lengthNorm("foo",i-8), s.lengthNorm("yak",i),
                   0.0f);
    }


    // steepness
View Full Code Here

Examples of org.apache.lucene.search.Similarity.lengthNorm()

    ss.setLengthNormFactors("b",5,8,0.1f, false);

    for (int i = 9; i < 1000; i++) {
      assertTrue("s: i="+i+" : a="+ss.lengthNorm("a",i)+
                 " < b="+ss.lengthNorm("b",i),
                 ss.lengthNorm("a",i) < s.lengthNorm("b",i));
    }

  }

  public void testSweetSpotTf() {
View Full Code Here

Examples of org.apache.lucene.search.Similarity.lengthNorm()

      byte[] norms = cachedNorms;
      Similarity sim = getSimilarity();
      if (fieldName != cachedFieldName || sim != cachedSimilarity) { // not cached?
        Info info = getInfo(fieldName);
        int numTokens = info != null ? info.numTokens : 0;
        float n = sim.lengthNorm(fieldName, numTokens);
        float boost = info != null ? info.getBoost() : 1.0f;
        n = n * boost; // see DocumentWriter.writeNorms(String segment)               
        byte norm = Similarity.encodeNorm(n);
        norms = new byte[] {norm};
       
View Full Code Here

Examples of org.apache.lucene.search.Similarity.lengthNorm()

    // base case, should degrade
 
    for (int i = 1; i < 1000; i++) {
      assertEquals("base case: i="+i,
                   d.lengthNorm("foo",i), s.lengthNorm("foo",i),
                   0.0f);
    }

    // make a sweet spot
 
View Full Code Here

Examples of org.apache.lucene.search.Similarity.lengthNorm()

 
    ss.setLengthNormFactors(3,10,0.5f);
 
    for (int i = 3; i <=10; i++) {
      assertEquals("3,10: spot i="+i,
                   1.0f, s.lengthNorm("foo",i),
                   0.0f);
    }
 
    for (int i = 10; i < 1000; i++) {
      assertEquals("3,10: 10<x : i="+i,
View Full Code Here

Examples of org.apache.lucene.search.Similarity.lengthNorm()

                   0.0f);
    }
 
    for (int i = 10; i < 1000; i++) {
      assertEquals("3,10: 10<x : i="+i,
                   d.lengthNorm("foo",i-9), s.lengthNorm("foo",i),
                   0.0f);
    }


    // seperate sweet spot for certain fields
View Full Code Here

Examples of org.apache.lucene.search.Similarity.lengthNorm()

    ss.setLengthNormFactors("yak",6,9, 0.5f);

 
    for (int i = 3; i <=10; i++) {
      assertEquals("f: 3,10: spot i="+i,
                   1.0f, s.lengthNorm("foo",i),
                   0.0f);
    }
    for (int i = 10; i < 1000; i++) {
      assertEquals("f: 3,10: 10<x : i="+i,
                   d.lengthNorm("foo",i-9), s.lengthNorm("foo",i),
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.