lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: QueryParser and NGrams
Date Fri, 12 Oct 2007 01:09:46 GMT

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





-Hoss


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