Package org.apache.lucene.search

Examples of org.apache.lucene.search.FieldCache


    dirB.close();
    super.tearDown();
  }

  public void testSanity() throws IOException {
    FieldCache cache = FieldCache.DEFAULT;
    cache.purgeAllCaches();

    cache.getDoubles(readerA, "theDouble");
    cache.getDoubles(readerA, "theDouble", FieldCache.DEFAULT_DOUBLE_PARSER);
    cache.getDoubles(readerB, "theDouble", FieldCache.DEFAULT_DOUBLE_PARSER);

    cache.getInts(readerX, "theInt");
    cache.getInts(readerX, "theInt", FieldCache.DEFAULT_INT_PARSER);

    // // //

    Insanity[] insanity =
      FieldCacheSanityChecker.checkSanity(cache.getCacheEntries());
   
    if (0 < insanity.length)
      dumpArray(getTestLabel() + " INSANITY", insanity, System.err);

    assertEquals("shouldn't be any cache insanity", 0, insanity.length);
    cache.purgeAllCaches();
  }
View Full Code Here


    assertEquals("shouldn't be any cache insanity", 0, insanity.length);
    cache.purgeAllCaches();
  }

  public void testInsanity1() throws IOException {
    FieldCache cache = FieldCache.DEFAULT;
    cache.purgeAllCaches();

    cache.getInts(readerX, "theInt", FieldCache.DEFAULT_INT_PARSER);
    cache.getStrings(readerX, "theInt");
    cache.getBytes(readerX, "theByte");

    // // //

    Insanity[] insanity =
      FieldCacheSanityChecker.checkSanity(cache.getCacheEntries());

    assertEquals("wrong number of cache errors", 1, insanity.length);
    assertEquals("wrong type of cache error",
                 InsanityType.VALUEMISMATCH,
                 insanity[0].getType());
    assertEquals("wrong number of entries in cache error", 2,
                 insanity[0].getCacheEntries().length);

    // we expect bad things, don't let tearDown complain about them
    cache.purgeAllCaches();
  }
View Full Code Here

    // we expect bad things, don't let tearDown complain about them
    cache.purgeAllCaches();
  }

  public void testInsanity2() throws IOException {
    FieldCache cache = FieldCache.DEFAULT;
    cache.purgeAllCaches();

    cache.getStrings(readerA, "theString");
    cache.getStrings(readerB, "theString");
    cache.getStrings(readerX, "theString");

    cache.getBytes(readerX, "theByte");


    // // //

    Insanity[] insanity =
      FieldCacheSanityChecker.checkSanity(cache.getCacheEntries());
   
    assertEquals("wrong number of cache errors", 1, insanity.length);
    assertEquals("wrong type of cache error",
                 InsanityType.SUBREADER,
                 insanity[0].getType());
    assertEquals("wrong number of entries in cache error", 3,
                 insanity[0].getCacheEntries().length);

    // we expect bad things, don't let tearDown complain about them
    cache.purgeAllCaches();
  }
View Full Code Here

    dirB.close();
    super.tearDown();
  }

  public void testSanity() throws IOException {
    FieldCache cache = FieldCache.DEFAULT;
    cache.purgeAllCaches();

    cache.getDoubles(readerA, "theDouble", false);
    cache.getDoubles(readerA, "theDouble", FieldCache.DEFAULT_DOUBLE_PARSER, false);
    cache.getDoubles(readerAclone, "theDouble", FieldCache.DEFAULT_DOUBLE_PARSER, false);
    cache.getDoubles(readerB, "theDouble", FieldCache.DEFAULT_DOUBLE_PARSER, false);

    cache.getInts(readerX, "theInt", false);
    cache.getInts(readerX, "theInt", FieldCache.DEFAULT_INT_PARSER, false);

    // // //

    Insanity[] insanity =
      FieldCacheSanityChecker.checkSanity(cache.getCacheEntries());
   
    if (0 < insanity.length)
      dumpArray(getTestClass().getName() + "#" + getTestName()
          + " INSANITY", insanity, System.err);

    assertEquals("shouldn't be any cache insanity", 0, insanity.length);
    cache.purgeAllCaches();
  }
View Full Code Here

    assertEquals("shouldn't be any cache insanity", 0, insanity.length);
    cache.purgeAllCaches();
  }

  public void testInsanity1() throws IOException {
    FieldCache cache = FieldCache.DEFAULT;
    cache.purgeAllCaches();

    cache.getInts(readerX, "theInt", FieldCache.DEFAULT_INT_PARSER, false);
    cache.getTerms(readerX, "theInt");
    cache.getBytes(readerX, "theByte", false);

    // // //

    Insanity[] insanity =
      FieldCacheSanityChecker.checkSanity(cache.getCacheEntries());

    assertEquals("wrong number of cache errors", 1, insanity.length);
    assertEquals("wrong type of cache error",
                 InsanityType.VALUEMISMATCH,
                 insanity[0].getType());
    assertEquals("wrong number of entries in cache error", 2,
                 insanity[0].getCacheEntries().length);

    // we expect bad things, don't let tearDown complain about them
    cache.purgeAllCaches();
  }
View Full Code Here

    // we expect bad things, don't let tearDown complain about them
    cache.purgeAllCaches();
  }

  public void testInsanity2() throws IOException {
    FieldCache cache = FieldCache.DEFAULT;
    cache.purgeAllCaches();

    cache.getTerms(readerA, "theInt");
    cache.getTerms(readerB, "theInt");
    cache.getTerms(readerX, "theInt");

    cache.getBytes(readerX, "theByte", false);


    // // //

    Insanity[] insanity =
      FieldCacheSanityChecker.checkSanity(cache.getCacheEntries());
   
    assertEquals("wrong number of cache errors", 1, insanity.length);
    assertEquals("wrong type of cache error",
                 InsanityType.SUBREADER,
                 insanity[0].getType());
    assertEquals("wrong number of entries in cache error", 3,
                 insanity[0].getCacheEntries().length);

    // we expect bad things, don't let tearDown complain about them
    cache.purgeAllCaches();
  }
View Full Code Here

    readerB.close();
    readerX.close();
  }

  public void testSanity() throws IOException {
    FieldCache cache = FieldCache.DEFAULT;
    cache.purgeAllCaches();

    double [] doubles;
    int [] ints;

    doubles = cache.getDoubles(readerA, "theDouble");
    doubles = cache.getDoubles(readerA, "theDouble",
                               FieldCache.DEFAULT_DOUBLE_PARSER);
    doubles = cache.getDoubles(readerB, "theDouble",
                               FieldCache.DEFAULT_DOUBLE_PARSER);

    ints = cache.getInts(readerX, "theInt");
    ints = cache.getInts(readerX, "theInt",
                         FieldCache.DEFAULT_INT_PARSER);

    // // //

    Insanity[] insanity =
      FieldCacheSanityChecker.checkSanity(cache.getCacheEntries());
   
    if (0 < insanity.length)
      dumpArray(getTestLabel() + " INSANITY", insanity, System.err);

    assertEquals("shouldn't be any cache insanity", 0, insanity.length);
    cache.purgeAllCaches();
  }
View Full Code Here

    assertEquals("shouldn't be any cache insanity", 0, insanity.length);
    cache.purgeAllCaches();
  }

  public void testInsanity1() throws IOException {
    FieldCache cache = FieldCache.DEFAULT;
    cache.purgeAllCaches();

    int [] ints;
    String [] strings;
    byte [] bytes;

    ints = cache.getInts(readerX, "theInt", FieldCache.DEFAULT_INT_PARSER);
    strings = cache.getStrings(readerX, "theInt");

    // this one is ok
    bytes = cache.getBytes(readerX, "theByte");

    // // //

    Insanity[] insanity =
      FieldCacheSanityChecker.checkSanity(cache.getCacheEntries());

    assertEquals("wrong number of cache errors", 1, insanity.length);
    assertEquals("wrong type of cache error",
                 InsanityType.VALUEMISMATCH,
                 insanity[0].getType());
    assertEquals("wrong number of entries in cache error", 2,
                 insanity[0].getCacheEntries().length);

    // we expect bad things, don't let tearDown complain about them
    cache.purgeAllCaches();
  }
View Full Code Here

    // we expect bad things, don't let tearDown complain about them
    cache.purgeAllCaches();
  }

  public void testInsanity2() throws IOException {
    FieldCache cache = FieldCache.DEFAULT;
    cache.purgeAllCaches();

    String [] strings;
    byte [] bytes;

    strings = cache.getStrings(readerA, "theString");
    strings = cache.getStrings(readerB, "theString");
    strings = cache.getStrings(readerX, "theString");

    // this one is ok
    bytes = cache.getBytes(readerX, "theByte");


    // // //

    Insanity[] insanity =
      FieldCacheSanityChecker.checkSanity(cache.getCacheEntries());
   
    assertEquals("wrong number of cache errors", 1, insanity.length);
    assertEquals("wrong type of cache error",
                 InsanityType.SUBREADER,
                 insanity[0].getType());
    assertEquals("wrong number of entries in cache error", 3,
                 insanity[0].getCacheEntries().length);

    // we expect bad things, don't let tearDown complain about them
    cache.purgeAllCaches();
  }
View Full Code Here

    readerB.close();
    readerX.close();
  }

  public void testSanity() throws IOException {
    FieldCache cache = FieldCache.DEFAULT;
    cache.purgeAllCaches();

    double [] doubles;
    int [] ints;

    doubles = cache.getDoubles(readerA, "theDouble");
    doubles = cache.getDoubles(readerA, "theDouble",
                               FieldCache.DEFAULT_DOUBLE_PARSER);
    doubles = cache.getDoubles(readerB, "theDouble",
                               FieldCache.DEFAULT_DOUBLE_PARSER);

    ints = cache.getInts(readerX, "theInt");
    ints = cache.getInts(readerX, "theInt",
                         FieldCache.DEFAULT_INT_PARSER);

    // // //

    Insanity[] insanity =
      FieldCacheSanityChecker.checkSanity(cache.getCacheEntries());
   
    if (0 < insanity.length)
      dumpArray(getTestLabel() + " INSANITY", insanity, System.err);

    assertEquals("shouldn't be any cache insanity", 0, insanity.length);
    cache.purgeAllCaches();
  }
View Full Code Here

TOP

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

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.