lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Wettin <karl.wet...@gmail.com>
Subject Re: QueryParser and NGrams
Date Fri, 12 Oct 2007 08:37:28 GMT

12 okt 2007 kl. 03.09 skrev Chris Hostetter:

>
> : No, sorry, I'm still confused. It ought to be a term queries?
>
> : > > System.out.println(new QueryParser("f", new Analyzer() {
> : > >   public TokenStream tokenStream(String string, Reader reader) {
> : > >     return new NGramTokenFilter(new StandardTokenizer 
> (reader), 2, 5);
> : > >   }
> : > > }).parse("hello world"));
>
> query parser does one pass looking for operators, it sees two  
> pieces of
> input: "hello" and "world" it hands each individually to your  
> analyzer.
>
> for each word, your analyzer produces multiple tokens -- which are  
> not at
> the same position (they have non zero positionIncrimentGap)   
> QueryParser
> sees the multiple tokens at consecutive positions, and constructs a  
> phrase
> query (per word).  if there was at least one token with a
> positionIncriment of 0, it would have created a MultiPhraseQuery (per
> word), if all had 0 positionIncriments, it would have constructed a
> BooleanQuery (per word) containing TermQueries.


Thanks!

-- 
karl

---------------------------------------------------------------------
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