You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by bryan rasmussen <ra...@gmail.com> on 2011/05/18 14:25:14 UTC

I need to improve highlighting

Hi,

If I do a search
http://localhost:8983/solr/tester/select/?q=kongeriget&hl=true then in
the <lst name="highlighting"> subtree I get
<arr name="all_text">
−
<str>
Aftale mellem <em>kongeriget</em> Danmark og <em>kongeriget</em> Sverige
</str>
</arr>
</lst>


What I need to do is to either

 1. Return all of all_text which should be possible by setting
hl.fragsize=0 but I still never go beyond the default for the field (I
can go less than 100 but not more)
2. Get a count of number of highlighted instances(preferable) or
return each highlighted text in a separate str element - so
<str>kongeriget</str><str>kongeriget</str>


thanks,
Bryan Rasmussen

Re: I need to improve highlighting

Posted by bryan rasmussen <ra...@gmail.com>.
> Bryan, on Q2 - what about using xpath like 'str/em' ?

How do I do that? The highlighting result, at least in the solr
installation I have (3. something) returns the em as escaped markup.
Is there an xpath parameter or configuration I can set for
highlighting, or a way to change the <em> elements to be actual
elements (hl.fomatter maybe?)

Thanks,
Bryan Rasmussen


> On Wed, May 18, 2011 at 2:25 PM, bryan rasmussen
> <ra...@gmail.com> wrote:
>> Hi,
>>
>> If I do a search
>> http://localhost:8983/solr/tester/select/?q=kongeriget&hl=true then in
>> the <lst name="highlighting"> subtree I get
>> <arr name="all_text">
>> -
>> <str>
>> Aftale mellem <em>kongeriget</em> Danmark og <em>kongeriget</em> Sverige
>> </str>
>> </arr>
>> </lst>
>>
>>
>> What I need to do is to either
>>
>>  1. Return all of all_text which should be possible by setting
>> hl.fragsize=0 but I still never go beyond the default for the field (I
>> can go less than 100 but not more)
>> 2. Get a count of number of highlighted instances(preferable) or
>> return each highlighted text in a separate str element - so
>> <str>kongeriget</str><str>kongeriget</str>
>>
>>
>> thanks,
>> Bryan Rasmussen
>>
>

Re: I need to improve highlighting

Posted by Stefan Matheis <ma...@googlemail.com>.
Bryan, on Q2 - what about using xpath like 'str/em' ?

Regards
Stefan

On Wed, May 18, 2011 at 2:25 PM, bryan rasmussen
<ra...@gmail.com> wrote:
> Hi,
>
> If I do a search
> http://localhost:8983/solr/tester/select/?q=kongeriget&hl=true then in
> the <lst name="highlighting"> subtree I get
> <arr name="all_text">
> -
> <str>
> Aftale mellem <em>kongeriget</em> Danmark og <em>kongeriget</em> Sverige
> </str>
> </arr>
> </lst>
>
>
> What I need to do is to either
>
>  1. Return all of all_text which should be possible by setting
> hl.fragsize=0 but I still never go beyond the default for the field (I
> can go less than 100 but not more)
> 2. Get a count of number of highlighted instances(preferable) or
> return each highlighted text in a separate str element - so
> <str>kongeriget</str><str>kongeriget</str>
>
>
> thanks,
> Bryan Rasmussen
>

Re: I need to improve highlighting

Posted by bryan rasmussen <ra...@gmail.com>.
yeah but you just got me to check again, what I thought was ignoring
my setting of hl.fragsize and always using the default ended up just
returning a smaller field higher ranked, so when I set it to 1000 and
saw the same as what I saw with 100 was the just the off chance that
there was only 100 to see in the first 10 results. funny.

thanks,
Bryan Rasmussen

On Wed, May 18, 2011 at 2:59 PM, Erick Erickson <er...@gmail.com> wrote:
> Just checking, but have you tried setting
> hl.fragsize=<very large number> as suggested here:
>
> http://wiki.apache.org/solr/HighlightingParameters#hl.fragsize ?
>
> If that's not the problem, please show us the results of
> attaching &debugQuery=on to the request, that may shed
> some light on the problem.
>
> Best
> Erick
>
> On Wed, May 18, 2011 at 8:25 AM, bryan rasmussen
> <ra...@gmail.com> wrote:
>> Hi,
>>
>> If I do a search
>> http://localhost:8983/solr/tester/select/?q=kongeriget&hl=true then in
>> the <lst name="highlighting"> subtree I get
>> <arr name="all_text">
>> -
>> <str>
>> Aftale mellem <em>kongeriget</em> Danmark og <em>kongeriget</em> Sverige
>> </str>
>> </arr>
>> </lst>
>>
>>
>> What I need to do is to either
>>
>>  1. Return all of all_text which should be possible by setting
>> hl.fragsize=0 but I still never go beyond the default for the field (I
>> can go less than 100 but not more)
>> 2. Get a count of number of highlighted instances(preferable) or
>> return each highlighted text in a separate str element - so
>> <str>kongeriget</str><str>kongeriget</str>
>>
>>
>> thanks,
>> Bryan Rasmussen
>>
>

Re: I need to improve highlighting

Posted by Erick Erickson <er...@gmail.com>.
Just checking, but have you tried setting
hl.fragsize=<very large number> as suggested here:

http://wiki.apache.org/solr/HighlightingParameters#hl.fragsize ?

If that's not the problem, please show us the results of
attaching &debugQuery=on to the request, that may shed
some light on the problem.

Best
Erick

On Wed, May 18, 2011 at 8:25 AM, bryan rasmussen
<ra...@gmail.com> wrote:
> Hi,
>
> If I do a search
> http://localhost:8983/solr/tester/select/?q=kongeriget&hl=true then in
> the <lst name="highlighting"> subtree I get
> <arr name="all_text">
> -
> <str>
> Aftale mellem <em>kongeriget</em> Danmark og <em>kongeriget</em> Sverige
> </str>
> </arr>
> </lst>
>
>
> What I need to do is to either
>
>  1. Return all of all_text which should be possible by setting
> hl.fragsize=0 but I still never go beyond the default for the field (I
> can go less than 100 but not more)
> 2. Get a count of number of highlighted instances(preferable) or
> return each highlighted text in a separate str element - so
> <str>kongeriget</str><str>kongeriget</str>
>
>
> thanks,
> Bryan Rasmussen
>