/// <summary> /// Gets a subset of search results to search in based on the current criteria /// </summary> /// <param name="criteriaSet"></param> /// <returns>Search subset</returns> protected virtual SearchSubset GetSearchSubset(SearchCriteriaSet criteriaSet) { ICacheable finalEntry = null; int hashSum = criteriaSet.DescriptionFilter.GetHashCode(); int i, n = criteriaSet.Count; for (i = 0; i < n; i++) { ISearchCriteria criteria = criteriaSet[i]; //combine the current hash with the pervious hash hashSum = hashSum ^ criteria.GetHashCode(); //check if a subset is cached for this hash ICacheable entry = SearchSubsetsCache.Instance.GetEntry(hashSum); if (entry != null) { criteriaSet.StartCriteriaIndex = i; finalEntry = entry; } else { break; } } SearchSubset subset = null; if (finalEntry != null) { subset = finalEntry.GetClone() as SearchSubset; } return(subset); }