Package org.apache.lucene.index

Examples of org.apache.lucene.index.FieldNormModifier


  }
  writer.close();
    }
   
    public void testMissingField() {
  FieldNormModifier fnm = new FieldNormModifier(store, s);
  try {
      fnm.reSetNorms("nobodyherebutuschickens");
  } catch (Exception e) {
      assertNull("caught something", e);
  }
    }
View Full Code Here


  assertTrue("Whoops we have norms?", !r.hasNorms("nonorm"));
  assertNull(norms);

  r.close();
 
  FieldNormModifier fnm = new FieldNormModifier(store, s);
  try {
      fnm.reSetNorms("nonorm");
  } catch (Exception e) {
      assertNull("caught something", e);
  }

  // nothing should have changed
View Full Code Here

    @Override
    public float lengthNorm(String fieldName, int numTokens) {
        return numTokens;
    }
      };
  FieldNormModifier fnm = new FieldNormModifier(store, s);
  fnm.reSetNorms("field");

  // new norm (with default similarity) should put longer docs first
  searcher = new IndexSearcher(store, false);
  searcher.search(new TermQuery(new Term("field", "word")), new Collector() {
      private int docBase = 0;
View Full Code Here

      store.close();
      super.tearDown();
    }
   
    public void testMissingField() throws Exception {
  FieldNormModifier fnm = new FieldNormModifier(store, s);
  try {
      fnm.reSetNorms("nobodyherebutuschickens");
  } catch (IllegalStateException e) {
      // expected
  }
    }
View Full Code Here

  assertTrue("Whoops we have norms?", !r.hasNorms("nonorm"));
  assertNull(norms);

  r.close();
 
  FieldNormModifier fnm = new FieldNormModifier(store, s);
  try {
      fnm.reSetNorms("nonorm");
  } catch (IllegalStateException e) {
    // expected
  }

  // nothing should have changed
View Full Code Here

            @Override
            public float computeNorm(String fieldName, FieldInvertState state) {
              return state.getBoost() * (discountOverlaps ? state.getLength() - state.getNumOverlap() : state.getLength());
            }
          };
  FieldNormModifier fnm = new FieldNormModifier(store, s);
  fnm.reSetNorms("field");

  // new norm (with default similarity) should put longer docs first
  searcher = new IndexSearcher(store, false);
  searcher.search(new TermQuery(new Term("field", "word")), new Collector() {
      private int docBase = 0;
View Full Code Here

  }
  writer.close();
    }
   
    public void testMissingField() {
  FieldNormModifier fnm = new FieldNormModifier(store, s);
  try {
      fnm.reSetNorms("nobodyherebutuschickens");
  } catch (Exception e) {
      assertNull("caught something", e);
  }
    }
View Full Code Here

          assertNull(norms);
        }

  r.close();
 
  FieldNormModifier fnm = new FieldNormModifier(store, s);
  try {
      fnm.reSetNorms("nonorm");
  } catch (Exception e) {
      assertNull("caught something", e);
  }

  // nothing should have changed
View Full Code Here

  Similarity s = new DefaultSimilarity() {
    public float lengthNorm(String fieldName, int numTokens) {
        return numTokens;
    }
      };
  FieldNormModifier fnm = new FieldNormModifier(store, s);
  fnm.reSetNorms("field");

  // new norm (with default similarity) should put longer docs first
  searcher = new IndexSearcher(store);
  searcher.search(new TermQuery(new Term("field", "word")), new Collector() {
      private int docBase = 0;
View Full Code Here

      store.close();
      super.tearDown();
    }
   
    public void testMissingField() throws Exception {
  FieldNormModifier fnm = new FieldNormModifier(store, s);
  try {
      fnm.reSetNorms("nobodyherebutuschickens");
  } catch (IllegalStateException e) {
      // expected
  }
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.FieldNormModifier

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.