void SearchToken(SearchResult result, Token token)
		{
			Postings postings = (Postings)_postings[token.Value];
			if (null != postings)
			{
				AddToResult(result, postings);
			}

		}
		SearchResult IncludeAll(ITokenizer tokenizer, Token token)
		{
			ArrayList results = new ArrayList();
			while (null != token)
			{
				SearchResult tokenResult = new SearchResult();
				SearchToken(tokenResult, token);
				results.Add(tokenResult);

				token = tokenizer.NextToken();
			}

			SearchResult result = (SearchResult)results[0];
			for (int i=1; i<results.Count && result.Count > 0; ++i)
			{
				result = result.Intersect((SearchResult)results[i]);
			}
			return result;
		}
		void IndexByToken(Token token, IRecord record, IndexedField field)
		{
			Postings postings = (Postings)_postings[token.Value];
			if (null == postings)
			{
				postings = new Postings(token.Value);
				_postings[token.Value] = postings;
			}
			postings.Add(record, field, token.Position);
		}
		SearchResult IncludeAny(ITokenizer tokenizer, Token token)
		{
			SearchResult result = new SearchResult();
			while (null != token)
			{
				SearchToken(result, token);
				token = tokenizer.NextToken();
			}
			return result;
		}
		/// <summary>
		/// Test if the token is a valid token and 
		/// as such should be returned to the
		/// caller of <see cref="NextToken" />.
		/// </summary>
		/// <param name="token">token to be tested</param>
		/// <returns>true if the token is valid, false otherwise</returns>
		protected abstract bool IsValidToken(Token token);
Пример #6
0
		/// <summary>
		/// See <see cref="ConditionalFilter.IsValidToken"/> for details.
		/// </summary>
		/// <param name="token"></param>
		/// <returns></returns>
		protected override bool IsValidToken(Token token)
		{
			return !_words.ContainsKey(token.Value);
		}
		/// <summary>
		/// See <see cref="ConditionalFilter.IsValidToken"/> for details.
		/// </summary>
		/// <param name="token"></param>
		/// <returns></returns>
		protected override bool IsValidToken(Token token)
		{
			return (token.Value.Length >= _minTokenLength);
		}
		/// <summary>
		/// See <see cref="ConditionalFilter.IsValidToken"/> for details.
		/// </summary>
		/// <param name="token"></param>
		/// <returns></returns>
		protected override bool IsValidToken(Token token)
		{
			return !_regex.IsMatch(token.Value);
		}