lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Antonio Farré Basurte <juan.fa...@reviewpro.com>
Subject Re: Highlighting does not work when using !boost as a nested query
Date Thu, 19 May 2011 09:31:42 GMT
Hi,

The query is generated dynamically and can be more or less complex depending on different
parameters. I'm also not free to give many details of our implementation, but I'll give you
the minimal query string that fails and the relevant pieces of the config.
The query string is:

/select?q=+id:12345^0.000001 +_query_:"{!boost b=$dateboost v=$qq deftype=dismax}"&dateboost=recip(ms(NOW/DAY,published_date),3.16e-11,1,1)&qq=user_text&qf=text1^2
text2&pf=text1^2 text2&tie=0.1&q.alt=*:*&hl=true&hl.fl=text1 text2&hl.mergeContiguous=true

where id is an int and text1 and text2 are type text. hl.fl has proven to be necessary whenever
I use dismax in an inner query. Ohterwise, only text2 (the default field) is highlighted,
and not both fields appearing in qf. For example,
q={!dismax v=$qq}&....... does not require hl.fl to highlight both text1 and text2.
q=+_query_:"{!dismax v=$qq}"&....... only highlights text2, unless I specify hl.fl.

The given query is probably not minimal in the sense that some of the dismax-related parameters
can be omitted and the query still fails. But the one given always fails (and adding more
complexity to it does not make it work, quite obviously). Unfortunately, hl.requireFieldMatch=false
does not help.

Request handler config is the following:

<requestHandler name="standard" class="solr.SearchHandler" default="true">
  <lst name="defaults">
    <str name="echoParams">explicit</str>
  </lst>
</requestHandler>

Highlighter config is the following:

<highlighting>
  <fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true">
    <lst name="defaults">
      <int name="hl.fragsize">100</int>
    </lst>
  </fragmenter>
  <fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter">
    <lst name="defaults">
      <int name="hl.fragsize">70</int>
      <float name="hl.regex.slop">0.5</float>
      <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>
    </lst>
  </fragmenter>
  <formatter name="html" class="org.apache.solr.highlight.HtmlFormatter" default="true">
    <lst name="defaults">
      <str name="hl.simple.pre"><em></str>
      <str name="hl.simple.post"></em></str>
    </lst>
  </formatter>
</highlighting>

If there's any other information that could be useful, just ask.
Thank you very much for your help,

Juan

El 16/05/2011, a las 23:18, Chris Hostetter escribió:

> 
> : As I said in my previous message, if I issue:
> : q=+field1:range +field2:value +_query_:{!dismax v=$qq}
> : highlighting works. I've just discovered the problem is not just with {!boost...}.
If I just add a bf parameter to the previous query, highlighting also fails.
> : Anybody knows what can be happening? I'm really stuck on this problem...
> 
> Just a hunch, but i suspect the problem has to do with 
> highlighter (or maybe it's the fragment generator?) trying to determine
> matches from query types it doens't understand 
> 
> I thought there was a query param you could use to tell the highlighter to 
> use an "alternate" query string (that would be simpler) instead of the 
> real query ... but i'm not seeing it in the docs.
> 
> hl.requireFieldMatch=false might also help (not sure)
> 
> In general it would probably be helpful for folks if you could post the 
> *entire* request you are making (full query string and all request params) 
> along with the solrconfig.xml sections that show how your request handler 
> and highlighter are configured.
> 
> 
> 
> -Hoss


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message