lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sergiu gordea <gser...@ifit.uni-klu.ac.at>
Subject Re: QueryParser behaviour ..
Date Wed, 15 Feb 2006 12:24:09 GMT
Chris Hostetter wrote:

>: Exactly this is my question, why the QueryParser creates a Phrase query
>: when he gets several tokens from analyzer
>: and not a BooleanQuery?
>
>Because if it did that, there would be no way to write phrase queries :)
>  
>
I'm not very sure about this ...

>QueryParser only returns a BooleanQuery when *it* can tell you have
>several clauses.  For each "chunk" of text that it thinks of as one
>continuous piece of text (either because it doesn't contain whitespaces or
>  
>
wouldn't be better to let the analyzer decide if there is a continuous 
piece of text?
and to build PhraseQueries only when the quote sign is found?

>because it has quotes around it) it gives it to the analyzer, if the
>analyzer says there are multiple Terms there then QueryParser makes a
>PhraseQuery out of it.   or in a nutshell:
>   1) if the Parser detects multiple terms, it makes a boolean query
>   2) if the Analyzer detects multiple terms, it makes a phrase query
>  
>
this is related with my comment above. From the user's point of view I 
think it will make sense to
build a phrase query only when the quotes are found in the search string.

I think there are pro and con arguments, for "unifying" the behaviour.
I would be happy if the QueryParser wouldn't create phrase queries if i 
didn't explicitly  asked to do it.

Does someone have a different opinion?

>if you don't like this behavior, it can all be circumvented by overriding
>getFieldQuery().  you don't even have to teal with the analyzer if you
>don't want to.  just call super.getFieldQuery() and if you get back a
>PhraseQuery take it apart and build TermQueries wrapped in a boolean
>query.
>  
>
Well,  there is  all  the time  a work around.  It is obvious that 
searching for word1,word2,word3 was a
silly mistake, but I needed one hour to find why a PhraseQuery is 
created when no quotes existed in the query string.

So ... my opinion is that what I suggest will improve the usability of 
lucene, I hope that  the  lucene developers  share 
my opinion.

 Best,

 Sergiu

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


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