KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > modules > search > RecordLookUpAnalyzer


1 /*
2  * Created on Apr 13, 2006
3  */

4 package com.openedit.modules.search;
5
6 import java.io.Reader JavaDoc;
7
8 import org.apache.lucene.analysis.Analyzer;
9 import org.apache.lucene.analysis.LowerCaseFilter;
10 import org.apache.lucene.analysis.TokenStream;
11 import org.apache.lucene.analysis.WhitespaceTokenizer;
12
13 /**
14  * ID's must be separated by spaces and will become case insenstive
15  * You can use any chars in the ID
16  * Will produce exact matches
17  *
18  * @author cburkey
19  *
20  */

21 public class RecordLookUpAnalyzer extends Analyzer
22 {
23     public TokenStream tokenStream(String JavaDoc fieldName, Reader JavaDoc reader)
24     {
25         TokenStream result = new WhitespaceTokenizer(reader);
26         result = new LowerCaseFilter(result);
27
28         //result = new NullFilter(result); //for debug
29
return result;
30     }
31     /*
32     class NullFilter extends TokenFilter
33     {
34         public NullFilter(TokenStream inStream)
35         {
36             super(inStream);
37         }
38         public Token next() throws IOException
39         {
40             Token node = input.next();
41             return node;
42         }
43     }
44     */

45     
46 }
47
Popular Tags