lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anshum <>
Subject Re: construct a field without analyzer?
Date Tue, 15 Feb 2011 04:14:35 GMT
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)

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
analyzer = new PerFieldAnalyzerWrapper(new StandardAnalyzer(
analyzer.addAnalyzer("anotherfield", new KeywordAnalyzer());

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

On Tue, Feb 15, 2011 at 2:19 AM, Yuhan Zhang <> 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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message