/// <summary> /// Delegates to <see cref="Bamboo.Prevalence.Indexing.FullText.FullTextSearchIndex.Search"/>. /// </summary> /// <param name="index">index</param> /// <returns></returns> /// <exception cref="ArgumentException">if the /// index argument is not of the correct type</exception> public Bamboo.Prevalence.Indexing.SearchResult Evaluate(Bamboo.Prevalence.Indexing.IIndex index) { FullTextSearchIndex ftindex = index as FullTextSearchIndex; if (null == ftindex) { throw new ArgumentException("FullTextSearchExpression objects can be evaluated against FullTextSearchIndex objects only!"); } return(ftindex.Search(this)); }
public void SetUp() { FullTextSearchIndex index = new FullTextSearchIndex(); index.Fields.Add("Title"); FullTextSearchIndex multipleFieldIndex = new FullTextSearchIndex(); multipleFieldIndex.Fields.Add("Title"); multipleFieldIndex.Fields.Add("Ingredients"); _index = index; _multipleFieldIndex = multipleFieldIndex; _record1 = new HashtableRecord(); _record1["Title"] = "Bolo de Chocolate"; _record1["Calories"] = 300; _record1["Ingredients"] = "3 colheres de açucar\n1 lata de nescau\nfermento"; _index.Add(_record1); _multipleFieldIndex.Add(_record1); DumpPostings(index.Postings); _record2 = new HashtableRecord(); _record2["Title"] = "Bolo de Açafrão"; _record2["Calories"] = 100; _record2["Ingredients"] = "10 folhas de açafrão\n1 colher de fermento em pó"; _index.Add(_record2); _multipleFieldIndex.Add(_record2); DumpPostings(index.Postings); _record3 = new HashtableRecord(); _record3["Title"] = "Torta de Chocolate"; _record3["Calories"] = 400; _record3["Ingredients"] = "1 lata de nescau\nchocolate granulado\naçucar"; _index.Add(_record3); _multipleFieldIndex.Add(_record3); DumpPostings(index.Postings); }