You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Joe Attardi <ja...@gmail.com> on 2007/07/30 16:52:41 UTC

Running query text through an Analyzer without QueryParser?

Following up on my recent question. It has been suggested to me that I can
run the query text through an Analyzer without using the QueryParser. For
example, if I know what field to be searched I can create a PrefixQuery or
WildcardQuery, but still want to process the search text with the same
Analyzer that did the indexing. How do I run a query through an Analyzer
without using the QueryParser... is this possible?

Re: Running query text through an Analyzer without QueryParser?

Posted by Joe Attardi <ja...@gmail.com>.
So then would I just concatenate the tokens together to form the query text?

-- 
Joe Attardi
jattardi@gmail.com
http://thinksincode.blogspot.com/

On 7/30/07, Erick Erickson <er...@gmail.com> wrote:
>
> Would this work?
>
> TokenStream ts =  StandardAnalyzer.tokenStream();
> while ((Token tok = ts.next()) != null) {
>     do whatever
> }
>
> Best
> Erick
>
> On 7/30/07, Joe Attardi <ja...@gmail.com> wrote:
> >
> > Following up on my recent question. It has been suggested to me that I
> can
> > run the query text through an Analyzer without using the QueryParser.
> For
> > example, if I know what field to be searched I can create a PrefixQuery
> or
> > WildcardQuery, but still want to process the search text with the same
> > Analyzer that did the indexing. How do I run a query through an Analyzer
> > without using the QueryParser... is this possible?
> >
>

Re: Running query text through an Analyzer without QueryParser?

Posted by Erick Erickson <er...@gmail.com>.
Would this work?

TokenStream ts =  StandardAnalyzer.tokenStream();
while ((Token tok = ts.next()) != null) {
    do whatever
}

Best
Erick

On 7/30/07, Joe Attardi <ja...@gmail.com> wrote:
>
> Following up on my recent question. It has been suggested to me that I can
> run the query text through an Analyzer without using the QueryParser. For
> example, if I know what field to be searched I can create a PrefixQuery or
> WildcardQuery, but still want to process the search text with the same
> Analyzer that did the indexing. How do I run a query through an Analyzer
> without using the QueryParser... is this possible?
>