/// <summary> /// Adds a new item to the collection of items /// returned by the search. If the hit /// represents an existing record it /// will be combined to the existing hit instead. /// </summary> /// <param name="hit">the hit to be added or /// combined to a existing hit</param> public void Add(SearchHit hit) { SearchHit existing = FindSearchHit(hit.Record); if (null != existing) { existing.Combine(hit); } else { _hits.Add(hit); } }
/// <summary> /// Set intersection operation. Creates /// a new SearchResult with all the records /// that exist in both SearchResult objects. /// </summary> /// <param name="other"></param> /// <returns>a SearchResult representing the /// intersection between the this and other objects /// </returns> /// <remarks>all the SearchHit objects in /// the resulting SearchResult are clones from /// the original ones combined to the ones in /// other</remarks> public SearchResult Intersect(SearchResult other) { SearchResult result = new SearchResult(); foreach (SearchHit hit in _hits) { SearchHit otherHit = other.FindSearchHit(hit.Record); if (null != otherHit) { SearchHit resultingHit = hit.Clone(); resultingHit.Combine(otherHit); result.Add(resultingHit); } } return(result); }
/// <summary> /// combines two search hits that refer /// to the same record. all the extended /// properties such as ranking and index specific /// information should be combined. /// </summary> /// <param name="other">the SearchHit that /// should be combined to this one</param> public void Combine(SearchHit other) { }
public bool Test(SearchHit hit) { int age = (int)hit.Record["Age"]; return (age >= _min && age <= _max); }