lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claude Libois <clib...@student.fsa.ucl.ac.be>
Subject Re: Different Analyzer for each Field
Date Tue, 29 Jul 2003 07:10:07 GMT
Thank you for all your answer. Gregor I will do what you told me. It's 
exactly what I need.
Claude

On Monday, July 28, 2003, at 07:09 PM, Gregor Heinrich wrote:

>
> Hi Claude,
>
> one solution is to make the tokenStream method in the Analyzer subclass
> listen to the field name. Example:
>
> 	public TokenStream tokenStream(String fieldName, Reader reader) {
> 		TokenStream result = new StandardTokenizer(reader);
>
> 		result = new StandardFilter(result);
> 		result = new LowerCaseFilter(result);
> 		result = new StopFilter(result, stoptable);
> 		if (fieldName.startsWith("phonetic_") && phon != null) {
> 			result = new PhoneticFilter(result, phon);
> 			return result;
> 		}
> 		result = new SnowballFilter(result, "German");
> 		return result;
> 	}
>
> (In my index I have phonetically encoded fields that are filtered
> differently.)
>
> Ciao, Gregor
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message