Esempio n. 1
0
 /// <summary>Provide the DocIdSet to be cached, using the DocIdSet provided
 /// by the wrapped Filter.
 /// This implementation returns the given DocIdSet.
 /// </summary>
 protected internal virtual DocIdSet DocIdSetToCache(DocIdSet docIdSet, IndexReader reader)
 {
     if (docIdSet == null)
     {
         // this is better than returning null, as the nonnull result can be cached
         return(DocIdSet.EMPTY_DOCIDSET);
     }
     else if (docIdSet.IsCacheable())
     {
         return(docIdSet);
     }
     else
     {
         DocIdSetIterator it = docIdSet.Iterator();
         // null is allowed to be returned by iterator(),
         // in this case we wrap with the empty set,
         // which is cacheable.
         return((it == null) ? DocIdSet.EMPTY_DOCIDSET : new OpenBitSetDISI(it, reader.MaxDoc()));
     }
 }
Esempio n. 2
0
 /// <summary>This DocIdSet implementation is cacheable if the inner set is cacheable. </summary>
 public override bool IsCacheable()
 {
     return(_innerSet.IsCacheable());
 }
Esempio n. 3
0
		/// <summary>Provide the DocIdSet to be cached, using the DocIdSet provided
		/// by the wrapped Filter.
		/// This implementation returns the given DocIdSet.
		/// </summary>
		protected internal virtual DocIdSet DocIdSetToCache(DocIdSet docIdSet, IndexReader reader)
		{
            if (docIdSet == null)
            {
                // this is better than returning null, as the nonnull result can be cached
                return DocIdSet.EMPTY_DOCIDSET;
            }
            else if (docIdSet.IsCacheable()) {
				return docIdSet;
			}
			else
			{
				DocIdSetIterator it = docIdSet.Iterator();
				// null is allowed to be returned by iterator(),
				// in this case we wrap with the empty set,
				// which is cacheable.
				return (it == null) ? DocIdSet.EMPTY_DOCIDSET : new OpenBitSetDISI(it, reader.MaxDoc());
			}
		}