public PostingList(string term, List <string> directories, string filename) { this.Term = term; shards = new PostingUnion[directories.Count()]; for (int shard = 0; shard < directories.Count; shard++) { shards[shard] = new PostingUnion(Path.Combine(directories[shard], filename)); } }
public PostingUnion Union(PostingUnion iother, bool max) { PostingUnion other = iother as PostingUnion; PostingUnion result = new PostingUnion(max); foreach (var a in this.arrays) { result.arrays.Add(a); } foreach (var a in other.arrays) { result.arrays.Add(a); } return(result); }
public PostingUnion Intersection(PostingUnion iother, bool max) { PostingUnion other = iother as PostingUnion; List <PostingArray> newArray = new List <PostingArray>(); for (int i = 0; i < this.arrays.Count(); i++) { for (int j = 0; j < other.arrays.Count(); j++) { newArray.Add(this.arrays[i].Intersection(other.arrays[j], max) as PostingArray); } } PostingUnion result = new PostingUnion(newArray, this.max); if (newArray.Count() > 10) { result.Resolve(); } return(result); }