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 Alexey Shakov <al...@menta.de> on 2008/01/15 13:53:30 UTC

highlighting marks wrong words

Hi all,

I have a query like this:

q=(auto) AND id:(100 OR 1 OR 2 OR 3 OR 5 OR 
6)&fl=score&hl.fl=content&hl=true&hl.fragsize=200&hl.snippets=2&hl.simple.pre=%3Cb%3E&hl.simple.post=%3C%2Fb%3E&start=0&rows=10

Default field is content.

So, I expect, that only occurrencies of "auto" will be marked.

BUT: the occurrencies of id (100, 1, 2, ..), which occasionally also 
present in content field, are marked as well...

The result looks like:

North American International <b>Auto</b> Show 2007 - Celebrating 
<b>100</b> years


Any ideas?

Thanx in advance!



Re: highlighting marks wrong words

Posted by Alexey Shakov <al...@menta.de>.
Thank you! It works correct with filter query

Charlie Jackson schrieb:
>  I believe changing the "AND id: etc etc " part of the query to it's on
>  filter query will take care of your highlighting problem.
>
>  In other words, try a query like this:
>
>  q=(auto)&fq=id:(100 OR 1 OR 2 OR 3 OR 5 OR
>  6)&fl=score&hl.fl=content&hl=true&hl.fragsize=200&hl.snippets=2&hl.simpl
>  e.pre=%3Cb%3E&hl.simple.post=%3C%2Fb%3E&start=0&rows=10
>
>  This could also get you a performance boost if you're querying against
>  this set of ids often.
>
>  -----Original Message-----
>  From: Alexey Shakov [mailto:alexey.shakov@menta.de]
>  Sent: Tuesday, January 15, 2008 6:54 AM
>  To: solr-user@lucene.apache.org
>  Subject: highlighting marks wrong words
>
>  Hi all,
>
>  I have a query like this:
>
>  q=(auto) AND id:(100 OR 1 OR 2 OR 3 OR 5 OR
>  6)&fl=score&hl.fl=content&hl=true&hl.fragsize=200&hl.snippets=2&hl.simpl
>  e.pre=%3Cb%3E&hl.simple.post=%3C%2Fb%3E&start=0&rows=10
>
>  Default field is content.
>
>  So, I expect, that only occurrencies of "auto" will be marked.
>
>  BUT: the occurrencies of id (100, 1, 2, ..), which occasionally also
>  present in content field, are marked as well...
>
>  The result looks like:
>
>  North American International <b>Auto</b> Show 2007 - Celebrating
>  <b>100</b> years
>
>
>  Any ideas?
>
>  Thanx in advance!
>
>




RE: highlighting marks wrong words

Posted by Charlie Jackson <Ch...@cision.com>.
I believe changing the "AND id: etc etc " part of the query to it's on
filter query will take care of your highlighting problem. 

In other words, try a query like this:

q=(auto)&fq=id:(100 OR 1 OR 2 OR 3 OR 5 OR
6)&fl=score&hl.fl=content&hl=true&hl.fragsize=200&hl.snippets=2&hl.simpl
e.pre=%3Cb%3E&hl.simple.post=%3C%2Fb%3E&start=0&rows=10

This could also get you a performance boost if you're querying against
this set of ids often.

-----Original Message-----
From: Alexey Shakov [mailto:alexey.shakov@menta.de] 
Sent: Tuesday, January 15, 2008 6:54 AM
To: solr-user@lucene.apache.org
Subject: highlighting marks wrong words

Hi all,

I have a query like this:

q=(auto) AND id:(100 OR 1 OR 2 OR 3 OR 5 OR 
6)&fl=score&hl.fl=content&hl=true&hl.fragsize=200&hl.snippets=2&hl.simpl
e.pre=%3Cb%3E&hl.simple.post=%3C%2Fb%3E&start=0&rows=10

Default field is content.

So, I expect, that only occurrencies of "auto" will be marked.

BUT: the occurrencies of id (100, 1, 2, ..), which occasionally also 
present in content field, are marked as well...

The result looks like:

North American International <b>Auto</b> Show 2007 - Celebrating 
<b>100</b> years


Any ideas?

Thanx in advance!