lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brendan Grainger <brendan.grain...@gmail.com>
Subject Re: Question about dismax query parsing
Date Fri, 14 Mar 2008 14:12:23 GMT
Got it.

Thanks so much.

Brendan

On Mar 14, 2008, at 8:11 AM, Erik Hatcher wrote:

>
> On Mar 13, 2008, at 3:06 AM, Brendan Grainger wrote:
>> Just started using the Dismax handler and it looks very promising.  
>> However I'm a little confused about this query. Could somebody  
>> please explain why I'm getting a phrase query here?
>
> You're not actually getting a PhraseQuery.  The  
> DisjunctionMaxQuery#toString() puts a "~" in for the tie breaker.   
> In general, a Query#toString is lossy/confusing - but better than  
> nothing.
>
>  public String toString(String field) {
>    StringBuffer buffer = new StringBuffer();
>    buffer.append("(");
>    for (int i = 0 ; i < disjuncts.size(); i++) {
>      Query subquery = (Query) disjuncts.get(i);
>      if (subquery instanceof BooleanQuery) {   // wrap sub-bools in  
> parens
>        buffer.append("(");
>        buffer.append(subquery.toString(field));
>        buffer.append(")");
>      }
>      else buffer.append(subquery.toString(field));
>      if (i != disjuncts.size()-1) buffer.append(" | ");
>    }
>    buffer.append(")");
>    if (tieBreakerMultiplier != 0.0f) {
>      buffer.append("~");
>      buffer.append(tieBreakerMultiplier);
>    }
>    if (getBoost() != 1.0) {
>      buffer.append("^");
>      buffer.append(getBoost());
>    }
>    return buffer.toString();
>  }
>
>
>> +(((title_t:mass) (title_t:air) (title_t:flow))~3) ()',
>> And is that extra () indicative of something? I have some stuff  
>> going on with synonyms and I'm wondering if the position of the  
>> tokens is off and causing this.
>
> That extra clause is Solr's dismax code putting in an empty clause -  
> I think that is the boosting query(?).
>
> 	Erik
>
>> The relevant output from debugQuery is below:
>>
>>
>>  'rawquerystring'=>'mass air flow',
>>  'querystring'=>'mass air flow',
>>  'parsedquery'=>'+((DisjunctionMaxQuery((title_t:mass))  
>> DisjunctionMaxQuery((title_t:air))  
>> DisjunctionMaxQuery((title_t:flow)))~3) ()',
>>  'parsedquery_toString'=>'+(((title_t:mass) (title_t:air)  
>> (title_t:flow))~3) ()',
>>
>> Thanks!
>


Mime
View raw message