lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Running query text through an Analyzer without QueryParser?
Date Mon, 30 Jul 2007 18:04:53 GMT

> 
> So then would I just concatenate the tokens together to form 
> the query text?

You might better create a TermQuery for each token instead of concatenating, and combine them
in a BooleanQuery and say wether all terms must or should occur. Very simple, see [1]

Regards Ard

[1] http://lucene.zones.apache.org:8080/hudson/job/Lucene-Nightly/javadoc/org/apache/lucene/search/BooleanQuery.html

> 
> -- 
> Joe Attardi
> jattardi@gmail.com
> http://thinksincode.blogspot.com/
> 
> On 7/30/07, Erick Erickson <erickerickson@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 <jattardi@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?
> > >
> >
> 

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


Mime
View raw message