Beispiel #1
0
 /// <summary>Returns a comparator if it is in the cache. </summary>
 internal static ScoreDocComparator Lookup(Monodoc.Lucene.Net.Index.IndexReader reader, System.String field, int type, System.Object factory)
 {
     FieldCacheImpl.Entry entry = (factory != null) ? new FieldCacheImpl.Entry(field, factory) : new FieldCacheImpl.Entry(field, type);
     lock (Comparators.SyncRoot)
     {
         System.Collections.Hashtable readerCache = (System.Collections.Hashtable)Comparators[reader];
         if (readerCache == null)
         {
             return(null);
         }
         return((ScoreDocComparator)readerCache[entry]);
     }
 }
Beispiel #2
0
 /// <summary>Stores a comparator into the cache. </summary>
 internal static System.Object Store(Monodoc.Lucene.Net.Index.IndexReader reader, System.String field, int type, System.Object factory, System.Object value_Renamed)
 {
     FieldCacheImpl.Entry entry = (factory != null) ? new FieldCacheImpl.Entry(field, factory) : new FieldCacheImpl.Entry(field, type);
     lock (Comparators.SyncRoot)
     {
         System.Collections.Hashtable readerCache = (System.Collections.Hashtable)Comparators[reader];
         if (readerCache == null)
         {
             readerCache         = new System.Collections.Hashtable();
             Comparators[reader] = readerCache;
         }
         System.Object tempObject;
         tempObject         = readerCache[entry];
         readerCache[entry] = value_Renamed;
         return(tempObject);
     }
 }