Hi Yuhan, By what I understand you are trying to construct an index and add a field to it which would not be analyzed. Am I correct? You could simply declare that field as new Field(...... , Index.NOT_ANALYZED) http://lucene.apache.org/java/3_0_1/api/core/org/apache/lucene/document/Field.html
Also, if you want to analyze it using an analyzer that is different from the one that you'd use for the other fields, you could use the perfieldanalyzer <snip> analyzer = new PerFieldAnalyzerWrapper(new StandardAnalyzer( Version.LUCENE_30)); analyzer.addAnalyzer("anotherfield", new KeywordAnalyzer()); </snip> In the above snip, I instantiate an analyzer which by default would use the StandardAnalyzer but for 'anotherfield' would use KeywordAnalyzer. Hope this helps you. -- Anshum Gupta http://ai-cafe.blogspot.com On Tue, Feb 15, 2011 at 2:19 AM, Yuhan Zhang <yzh...@onescreen.com> wrote: > Hi all, > > I am trying to index documents by phrases (multiple words) in the text, and > want to get around the StandardAnalyzer for this field. (however, I will > still > use standardAnalyzer for the other fields in the same document). > > so, how should I approach it? is there a way to construct a field by > directly > providing the terms without analyzer? (by tokenstream?) which class can > construct a set of keywords into a tokenstream? > > > Thank you. > > Yuhan >