/// <summary>
		/// Searches the index for the words included in
		/// the expression passed as argument. <br />
		/// All the fields are searched for every word
		/// in the expression.<br />		
		/// </summary>
		/// <param name="expression">search expression</param>
		/// <returns>
		/// When expression.SearchMode is
		/// <see cref="FullTextSearchMode.IncludeAny"/> every
		/// record for which at least one word in the expression
		/// implies a match will be returned.<br />
		/// When expression.SearchMode is 
		/// <see cref="FullTextSearchMode.IncludeAll" /> only
		/// those records for which all of the words in the expression
		/// imply a match will be returned.
		/// </returns>
		public Bamboo.Prevalence.Indexing.SearchResult Search(FullTextSearchExpression expression)
		{
			ITokenizer tokenizer = CreateTokenizer(expression.Expression);
			Token token = tokenizer.NextToken();
			if (null == token)
			{
				throw new ArgumentException("Invalid search expression. The expression must contain at least one valid token!", "expression");
			}

			long begin = System.Environment.TickCount;

			SearchResult result = null;
			if (expression.SearchMode == FullTextSearchMode.IncludeAny)
			{
				result = IncludeAny(tokenizer, token);
			}
			else
			{
				result = IncludeAll(tokenizer, token);
			}
			
			result.ElapsedTime = System.Environment.TickCount - begin;

			return result;
		}
		public void TestUpdate()
		{
			_record1["Title"] = "Torta de Salsinha";
			_index.Update(_record1);
			_multipleFieldIndex.Update(_record1);

			ISearchExpression expression = new FullTextSearchExpression("torta salsinha");
			AssertSearchContains(_index.Search(expression), _record1, _record3);

			AssertSearchContains(_multipleFieldIndex.Search(expression), _record1, _record3);
		}
		public void TestMultiIndexSimpleSearch()
		{
			ISearchExpression expression = new FullTextSearchExpression("nescau");
			AssertSearchContains(_multipleFieldIndex.Search(expression), _record1, _record3);

			expression = new FullTextSearchExpression("chocolate");
			AssertSearchContains(_multipleFieldIndex.Search(expression), _record1, _record3);

			expression = new FullTextSearchExpression("fermento");
			AssertSearchContains(_multipleFieldIndex.Search(expression), _record1, _record2);
		}
		public void TestIncludeAllSearch()
		{
			ISearchExpression expression = new FullTextSearchExpression("Bolo Chocolate", FullTextSearchMode.IncludeAll);
			AssertSearchContains(_index.Search(expression), _record1);
			AssertSearchContains(_multipleFieldIndex.Search(expression), _record1);

			expression = new FullTextSearchExpression("Bolo Açafrão", FullTextSearchMode.IncludeAll);
			AssertSearchContains(_index.Search(expression), _record2);
			AssertSearchContains(_multipleFieldIndex.Search(expression), _record2);

			expression = new FullTextSearchExpression("Torta Chocolate", FullTextSearchMode.IncludeAll);
			AssertSearchContains(_index.Search(expression), _record3);
			AssertSearchContains(_multipleFieldIndex.Search(expression), _record3);
		}
		public void TestSimpleSearch()
		{			
			ISearchExpression expression = new FullTextSearchExpression("bolo");
			AssertSearchContains(_index.Search(expression), _record1, _record2);

			expression = new FullTextSearchExpression("chocolate");
			AssertSearchContains(_index.Search(expression), _record1, _record3);

			expression = new FullTextSearchExpression("acafrão");
			AssertSearchContains(_index.Search(expression), _record2);

			expression = new FullTextSearchExpression("bolo AcaFrao");
			AssertSearchContains(_index.Search(expression), _record1, _record2);			
		}