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 Lee Smith <le...@weblee.co.uk> on 2010/03/09 21:23:44 UTC

Highlighting

Hey All

I have indexed a whole bunch of documents and now I want to search against them.

My search is going great all but highlighting.

I have these items set

hl=true
hl.snippets=2
hl.fl = attr_content
hl.fragsize=100

Everything works apart from the highlighted text found not being surrounded with a <em>

Am I missing a setting ?

Lee

Re: Highlighting

Posted by Lee Smith <le...@weblee.co.uk>.
Cant see why you would put highlighting in a separate field.

Isn't it the idea to highlight the content found in a search result like google would do ?

Lee


On 10 Mar 2010, at 15:52, Joe Calderon wrote:

> no, thats not the case, see this example response in json format:
> {
> "responseHeader":{
>  "status":0,
>  "QTime":0,
>  "params":{
> 	"indent":"on",
> 	"q":"title_edge:fami",
> 	"hl.fl":"title_edge",
> 	"wt":"json",
> 	"hl":"on",
> 	"rows":"1"}},
> "response":{"numFound":18,"start":0,"docs":[
> 	{
> 	 "title_id":1581,
> 	 "title_edge":"Family",
> 	 "num":4}]
> },
> "highlighting":{
>  "1581":{
> 	"title_edge":["<em>Fami</em>ly"]}}
> 
> 
> 
> see how the highlight info is separate from the results?
> 
> On Wed, Mar 10, 2010 at 7:44 AM, Lee Smith <le...@weblee.co.uk> wrote:
>> Im am getting results no problem with the query.
>> 
>> But from what I believe it should wrap <em/> around the text in the result.
>> 
>> So if I search ie Andrew  within the return content Ie would have the contents with the word <em>Andrew</em>
>> 
>> and hl.fl=attr_content
>> 
>> Thank you for you help
>> 
>> Begin forwarded message:
>> 
>>> From: Joe Calderon <ca...@gmail.com>
>>> Date: 10 March 2010 15:37:35 GMT
>>> To: solr-user@lucene.apache.org
>>> Subject: Re: Highlighting
>>> Reply-To: solr-user@lucene.apache.org
>>> 
>>> just to make sure were on the same page, youre saying that the
>>> highlight section of the response is empty right? the results section
>>> is never highlighted but a separate section contains the highlighted
>>> fields specified in hl.fl=
>>> 
>>> On Wed, Mar 10, 2010 at 5:23 AM, Ahmet Arslan <io...@yahoo.com> wrote:
>>>> 
>>>> 
>>>>> Yes Content is stored and I get same
>>>>> results adding that parameter.
>>>>> 
>>>>> Still not highlighting the content :-(
>>>>> 
>>>>> Any other ideas
>>>> 
>>>> What is the field type of attr_content? And what is your query?
>>>> 
>>>> Are you running your query on another field and then requesting snippets from
>>>> attr_content?
>>>> 
>>>> q:attr_content:somequery&hl=true&hl.fl=attr_content&hl.maxAnalyzedChars=-1 should return highlighting.
>>>> 
>>>> 
>>>> 
>>>> 
>> 
>> 


Re: Highlighting

Posted by Joe Calderon <ca...@gmail.com>.
no, thats not the case, see this example response in json format:
{
 "responseHeader":{
  "status":0,
  "QTime":0,
  "params":{
	"indent":"on",
	"q":"title_edge:fami",
	"hl.fl":"title_edge",
	"wt":"json",
	"hl":"on",
	"rows":"1"}},
 "response":{"numFound":18,"start":0,"docs":[
	{
	 "title_id":1581,
	 "title_edge":"Family",
	 "num":4}]
 },
 "highlighting":{
  "1581":{
	"title_edge":["<em>Fami</em>ly"]}}



see how the highlight info is separate from the results?

On Wed, Mar 10, 2010 at 7:44 AM, Lee Smith <le...@weblee.co.uk> wrote:
> Im am getting results no problem with the query.
>
> But from what I believe it should wrap <em/> around the text in the result.
>
> So if I search ie Andrew  within the return content Ie would have the contents with the word <em>Andrew</em>
>
> and hl.fl=attr_content
>
> Thank you for you help
>
> Begin forwarded message:
>
>> From: Joe Calderon <ca...@gmail.com>
>> Date: 10 March 2010 15:37:35 GMT
>> To: solr-user@lucene.apache.org
>> Subject: Re: Highlighting
>> Reply-To: solr-user@lucene.apache.org
>>
>> just to make sure were on the same page, youre saying that the
>> highlight section of the response is empty right? the results section
>> is never highlighted but a separate section contains the highlighted
>> fields specified in hl.fl=
>>
>> On Wed, Mar 10, 2010 at 5:23 AM, Ahmet Arslan <io...@yahoo.com> wrote:
>>>
>>>
>>>> Yes Content is stored and I get same
>>>> results adding that parameter.
>>>>
>>>> Still not highlighting the content :-(
>>>>
>>>> Any other ideas
>>>
>>> What is the field type of attr_content? And what is your query?
>>>
>>> Are you running your query on another field and then requesting snippets from
>>> attr_content?
>>>
>>> q:attr_content:somequery&hl=true&hl.fl=attr_content&hl.maxAnalyzedChars=-1 should return highlighting.
>>>
>>>
>>>
>>>
>
>

Fwd: Highlighting

Posted by Lee Smith <le...@weblee.co.uk>.
Im am getting results no problem with the query.

But from what I believe it should wrap <em/> around the text in the result.

So if I search ie Andrew  within the return content Ie would have the contents with the word <em>Andrew</em>

and hl.fl=attr_content

Thank you for you help

Begin forwarded message:

> From: Joe Calderon <ca...@gmail.com>
> Date: 10 March 2010 15:37:35 GMT
> To: solr-user@lucene.apache.org
> Subject: Re: Highlighting
> Reply-To: solr-user@lucene.apache.org
> 
> just to make sure were on the same page, youre saying that the
> highlight section of the response is empty right? the results section
> is never highlighted but a separate section contains the highlighted
> fields specified in hl.fl=
> 
> On Wed, Mar 10, 2010 at 5:23 AM, Ahmet Arslan <io...@yahoo.com> wrote:
>> 
>> 
>>> Yes Content is stored and I get same
>>> results adding that parameter.
>>> 
>>> Still not highlighting the content :-(
>>> 
>>> Any other ideas
>> 
>> What is the field type of attr_content? And what is your query?
>> 
>> Are you running your query on another field and then requesting snippets from
>> attr_content?
>> 
>> q:attr_content:somequery&hl=true&hl.fl=attr_content&hl.maxAnalyzedChars=-1 should return highlighting.
>> 
>> 
>> 
>> 


Re: Highlighting

Posted by Joe Calderon <ca...@gmail.com>.
just to make sure were on the same page, youre saying that the
highlight section of the response is empty right? the results section
is never highlighted but a separate section contains the highlighted
fields specified in hl.fl=

On Wed, Mar 10, 2010 at 5:23 AM, Ahmet Arslan <io...@yahoo.com> wrote:
>
>
>> Yes Content is stored and I get same
>> results adding that parameter.
>>
>> Still not highlighting the content :-(
>>
>> Any other ideas
>
> What is the field type of attr_content? And what is your query?
>
> Are you running your query on another field and then requesting snippets from
> attr_content?
>
> q:attr_content:somequery&hl=true&hl.fl=attr_content&hl.maxAnalyzedChars=-1 should return highlighting.
>
>
>
>

Re: Highlighting

Posted by Ahmet Arslan <io...@yahoo.com>.

> Yes Content is stored and I get same
> results adding that parameter.
> 
> Still not highlighting the content :-(
> 
> Any other ideas

What is the field type of attr_content? And what is your query? 

Are you running your query on another field and then requesting snippets from
attr_content? 

q:attr_content:somequery&hl=true&hl.fl=attr_content&hl.maxAnalyzedChars=-1 should return highlighting.


      

Re: Highlighting

Posted by Lee Smith <le...@weblee.co.uk>.
Yes Content is stored and I get same results adding that parameter.

Still not highlighting the content :-(

Any other ideas

Lee

On 9 Mar 2010, at 23:14, Ahmet Arslan wrote:

> 
>> Yes it shows when I run the debug 
>> 
>> -<lst
>> name="org.apache.solrhandler.component.HighlightComponent">
>>     <double name="time">0.0</double>
>> </lst>
>> 
>> Any other ideas ?
> 
> is the field attr_content stored?  Are you querying this field? What happens when you append &hl.maxAnalyzedChars=-1 to your search ulr?
> 
> 
> 


Re: Highlighting

Posted by Ahmet Arslan <io...@yahoo.com>.
> Yes it shows when I run the debug 
> 
> -<lst
> name="org.apache.solrhandler.component.HighlightComponent">
>     <double name="time">0.0</double>
>  </lst>
> 
> Any other ideas ?

is the field attr_content stored?  Are you querying this field? What happens when you append &hl.maxAnalyzedChars=-1 to your search ulr?


      

Re: Highlighting

Posted by Lee Smith <le...@weblee.co.uk>.
Yes it shows when I run the debug 

-<lst name="org.apache.solrhandler.component.HighlightComponent">
    <double name="time">0.0</double>
 </lst>

Any other ideas ?

On 9 Mar 2010, at 21:06, Joe Calderon wrote:

> did u enable the highlighting component in solrconfig.xml? try setting
> debugQuery=true to see if the highlighting component is even being
> called...
> 
> On Tue, Mar 9, 2010 at 12:23 PM, Lee Smith <le...@weblee.co.uk> wrote:
>> Hey All
>> 
>> I have indexed a whole bunch of documents and now I want to search against them.
>> 
>> My search is going great all but highlighting.
>> 
>> I have these items set
>> 
>> hl=true
>> hl.snippets=2
>> hl.fl = attr_content
>> hl.fragsize=100
>> 
>> Everything works apart from the highlighted text found not being surrounded with a <em>
>> 
>> Am I missing a setting ?
>> 
>> Lee


Re: Highlighting

Posted by Joe Calderon <ca...@gmail.com>.
did u enable the highlighting component in solrconfig.xml? try setting
debugQuery=true to see if the highlighting component is even being
called...

On Tue, Mar 9, 2010 at 12:23 PM, Lee Smith <le...@weblee.co.uk> wrote:
> Hey All
>
> I have indexed a whole bunch of documents and now I want to search against them.
>
> My search is going great all but highlighting.
>
> I have these items set
>
> hl=true
> hl.snippets=2
> hl.fl = attr_content
> hl.fragsize=100
>
> Everything works apart from the highlighted text found not being surrounded with a <em>
>
> Am I missing a setting ?
>
> Lee