lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sascha Szott" <sz...@zib.de>
Subject Re: How to display Highlight with VelocityResponseWriter?
Date Thu, 14 Jan 2010 00:28:31 GMT
Hi Qiuyan,

> Thanks a lot. It works now. When i added the line
> #set($hl = $response.highlighting)
> i got the highlighting. But i wonder if there's any document that
> describes the usage of that. I mean i didn't know the name of those
> methods. Actually i just managed to guess it.
Solritas (aka VelocityResponseWriter) binds a number of objects into a so
called VelocityContext (consult [1] for a complete list). You can think of
a map that allows you to access objects by symbolic names, e.g., an
instance of QueryResponse is stored under response (that's why you write
$response in your template).

Since $response is an instance of QueryResponse you can call all methods
on it the API [2] provides. Furthermore, Velocity incorporates a
JavaBean-like introspection mechanism that lets you write
$response.highlighting instead of $response.getHighlighting() (only a bit
of syntactic sugar).

-Sascha

[1] http://wiki.apache.org/solr/VelocityResponseWriter#line-93
[2]
http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/response/QueryResponse.html

> Quoting Sascha Szott <szott@zib.de>:
>
>> Qiuyan,
>>
>>> with highlight can also be displayed in the web gui. I've added <bool
>>> name="hl">true</bool> into the standard responseHandler and it already
>>> works, i.e without velocity. But the same line doesn't take effect in
>>> itas. Should i configure anything else? Thanks in advance.
>> First of all, just a few notes on the /itas request handler in your
>> solrconfig.xml:
>>
>> 1. The entry
>>
>> <arr name="components">
>>   <str>highlight</str>
>> </arr>
>>
>> is obsolete, since the highlighting component is a default search
>> component [1].
>>
>> 2. Note that since you didn't specify a value for hl.fl highlighting
>> will only affect the fields listed inside of qf.
>>
>> 3. Why did you override the default value of hl.fragmenter? In most
>> cases the default fragmenting algorithm (gap) works fine - and maybe
>> in yours as well?
>>
>>
>> To make sure all your hl related settings are correct, can you post
>> an xml output (change the wt parameter to xml) for a search with
>> highlighted results.
>>
>> And finally, can you post the vtl code snippet that should produce
>> the highlighted output.
>>
>> -Sascha
>>
>> [1] http://wiki.apache.org/solr/SearchComponent
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>


Mime
View raw message