public virtual void  TestInsanity2()
        {
            FieldCache cache = Lucene.Net.Search.FieldCache_Fields.DEFAULT;

            cache.PurgeAllCaches();

            System.String[] strings;
            sbyte[]         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());

            Assert.AreEqual(1, insanity.Length, "wrong number of cache errors");
            Assert.AreEqual(InsanityType.SUBREADER, insanity[0].GetType(), "wrong type of cache error");
            Assert.AreEqual(3, insanity[0].GetCacheEntries().Length, "wrong number of entries in cache error");

            // we expect bad things, don't let tearDown complain about them
            cache.PurgeAllCaches();
        }
        public virtual void  TestInsanity1()
        {
            FieldCache cache = Lucene.Net.Search.FieldCache_Fields.DEFAULT;

            cache.PurgeAllCaches();

            int[]           ints;
            System.String[] strings;
            sbyte[]         bytes;

            ints    = cache.GetInts(readerX, "theInt", Lucene.Net.Search.FieldCache_Fields.DEFAULT_INT_PARSER);
            strings = cache.GetStrings(readerX, "theInt");

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

            // // //

            Insanity[] insanity = FieldCacheSanityChecker.CheckSanity(cache.GetCacheEntries());

            Assert.AreEqual(1, insanity.Length, "wrong number of cache errors");
            Assert.AreEqual(InsanityType.VALUEMISMATCH, insanity[0].Type, "wrong type of cache error");
            Assert.AreEqual(2, insanity[0].GetCacheEntries().Length, "wrong number of entries in cache error");

            // we expect bad things, don't let tearDown complain about them
            cache.PurgeAllCaches();
        }
Exemplo n.º 3
0
		/*(non-Javadoc) @see Lucene.Net.Search.Function.FieldCacheSource#getCachedValues(Lucene.Net.Search.FieldCache, java.lang.String, Lucene.Net.Index.IndexReader) */
		public override DocValues GetCachedFieldValues(FieldCache cache, System.String field, IndexReader reader)
		{
			sbyte[] arr = cache.GetBytes(reader, field, parser);
			return new AnonymousClassDocValues(arr, this);
		}
Exemplo n.º 4
0
 /*(non-Javadoc) @see Lucene.Net.Search.Function.FieldCacheSource#getCachedValues(Lucene.Net.Search.FieldCache, java.lang.String, Lucene.Net.Index.IndexReader) */
 public override DocValues GetCachedFieldValues(FieldCache cache, System.String field, IndexReader reader)
 {
     byte[] arr = (parser == null) ? cache.GetBytes(reader, field) : cache.GetBytes(reader, field, parser);
     return(new AnonymousClassDocValues(arr, this));
 }
Exemplo n.º 5
0
 /*(non-Javadoc) <see cref="Lucene.Net.Search.Function.FieldCacheSource.getCachedValues(Lucene.Net.Search.FieldCache, java.lang.String, Lucene.Net.Index.IndexReader) */
 public override DocValues GetCachedFieldValues(FieldCache cache, string field, IndexReader reader)
 {
     sbyte[] arr = cache.GetBytes(reader, field, parser);
     return(new AnonymousClassDocValues(arr, this));
 }