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 Chantal Ackermann <ch...@btelligent.de> on 2010/01/08 14:23:55 UTC

Custom SearchHandler using existing DismaxRequestHandler

Dear all,

happy New Year!

For my custom searchHandler (called /list) that uses the 
VelocityResponseWriter I would like to use the existing dismax 
configuration. Therefore I did NOT specify ANY dismax configuration in 
that custom handler.

In short: it's not using (my existing) dismax at all, as it seems.
It only returns results for no parameters, using q.alt=*:* (defined in 
solrconfig.xml), or for q=field:value (even if dismax is default, and qt 
is missing).

Question: Is there a way to reference the existing dismax handler 
(=avoid copying of the existing configuration)?
(I couldn't find anything helpful in the wiki or the mailing lists. 
Maybe it's too obvious...?)

What I tried and did not work is the "qt" parameter. (This probably also 
requires it's own dismax configuration). Other variants of configuration 
I have marked with brackets in the pasted config below.


Thanks for your time!
Chantal



Configuration of dismax and the custom search handler (in brackets the 
different config variants I tried):

<requestHandler name="dismax" class="solr.SearchHandler" [default="true"]>
	<lst name="defaults">
		<str name="defType">dismax</str>
		<str name="echoParams">explicit</str>
		<float name="tie">0.01</float>
		<str name="qf"> ...fields... </str>
		<str name="pf"> ...fields... </str>
		<str name="fl"> *,score </str>
		<str name="mm"> 2&lt;-1 5&lt;80%</str>
		<int name="ps">100</int>
		<str name="q.alt">*:*</str>
     	</lst>
</requestHandler>

   <requestHandler name="/list" class="solr.SearchHandler">
      <lst name="defaults">
        <str name="v.template">listView</str>
        <str name="v.properties">velocity.properties</str>
        <str name="v.contentType">text/html;charset=UTF-8</str>
        <str name="title">Suchergebnisse</str>

        <str name="wt">velocity</str>
        [<str name="defType">dismax</str>]
        [<str name="qt">dismax</str>]
        [<str name="q.alt">*:*</str>]
        <str name="sort">score desc,start_date asc</str>
        <str name="rows">20</str>
        <str name="fl">*,score</str>
        <str name="facet">on</str>
        <str name="facet.field">participant</str>
        <str name="facet.field">decade</str>
        <str name="facet.field">timeweek</str>
        <str name="facet.field">cat</str>
        <str name="facet.field">maincat</str>
        <str name="facet.field">channel_name</str>
        <str name="facet.mincount">1</str>
      </lst>
   </requestHandler>

Re: Custom SearchHandler using existing DismaxRequestHandler

Posted by Erik Hatcher <er...@gmail.com>.
On Jan 8, 2010, at 9:31 AM, Chantal Ackermann wrote:
> I've copied the dismax configuration to the custom handler, and it  
> works fine, now.
> I have different velocity templates (=>different custom handlers),  
> so from quickly reading through your other suggestion I think that  
> would work with only one template/velocity view?

You can do it various ways... one request handler could be rendered  
through multiple views, just change v.template for each request to  
select a different template with the same request handler.   Or  
multiple request handlers could render all with the same template.


> It's for prototyping, anyway.

+1 for prototyping!

	Erik


Re: Custom SearchHandler using existing DismaxRequestHandler

Posted by Chantal Ackermann <ch...@btelligent.de>.
Thank you for your quick answer, Erik!

I've copied the dismax configuration to the custom handler, and it works 
fine, now.
I have different velocity templates (=>different custom handlers), so 
from quickly reading through your other suggestion I think that would 
work with only one template/velocity view?

It's for prototyping, anyway. I'll just have to remember to update all 
dismax configs.

Thanks again!
Chantal

Erik Hatcher schrieb:
> Chantal -
> 
> You'll have to copy the configuration to your various handlers.
> 
> However, with the VelocityResponseWriter, you can use your existing
> handlers and simply set wt=velocity on them by default, or set it from
> the client with &wt=velocity appended to the query string.   The
> VelocityResponseWriter will look for templates based on the request
> handler name (qt parameter), so <requestHandler name="dismax"> with
> wt=velocity will default to looking for a dismax.vm template for
> rendering.
> 
>         Erik
> 
> On Jan 8, 2010, at 8:23 AM, Chantal Ackermann wrote:
> 
>> Dear all,
>>
>> happy New Year!
>>
>> For my custom searchHandler (called /list) that uses the
>> VelocityResponseWriter I would like to use the existing dismax
>> configuration. Therefore I did NOT specify ANY dismax configuration
>> in that custom handler.
>>
>> In short: it's not using (my existing) dismax at all, as it seems.
>> It only returns results for no parameters, using q.alt=*:* (defined
>> in solrconfig.xml), or for q=field:value (even if dismax is default,
>> and qt is missing).
>>
>> Question: Is there a way to reference the existing dismax handler
>> (=avoid copying of the existing configuration)?
>> (I couldn't find anything helpful in the wiki or the mailing lists.
>> Maybe it's too obvious...?)
>>
>> What I tried and did not work is the "qt" parameter. (This probably
>> also requires it's own dismax configuration). Other variants of
>> configuration I have marked with brackets in the pasted config below.
>>
>>
>> Thanks for your time!
>> Chantal
>>
>>
>>
>> Configuration of dismax and the custom search handler (in brackets
>> the different config variants I tried):
>>
>> <requestHandler name="dismax"
>> class="solr.SearchHandler" [default="true"]>
>>       <lst name="defaults">
>>               <str name="defType">dismax</str>
>>               <str name="echoParams">explicit</str>
>>               <float name="tie">0.01</float>
>>               <str name="qf"> ...fields... </str>
>>               <str name="pf"> ...fields... </str>
>>               <str name="fl"> *,score </str>
>>               <str name="mm"> 2&lt;-1 5&lt;80%</str>
>>               <int name="ps">100</int>
>>               <str name="q.alt">*:*</str>
>>       </lst>
>> </requestHandler>
>>
>>  <requestHandler name="/list" class="solr.SearchHandler">
>>     <lst name="defaults">
>>       <str name="v.template">listView</str>
>>       <str name="v.properties">velocity.properties</str>
>>       <str name="v.contentType">text/html;charset=UTF-8</str>
>>       <str name="title">Suchergebnisse</str>
>>
>>       <str name="wt">velocity</str>
>>       [<str name="defType">dismax</str>]
>>       [<str name="qt">dismax</str>]
>>       [<str name="q.alt">*:*</str>]
>>       <str name="sort">score desc,start_date asc</str>
>>       <str name="rows">20</str>
>>       <str name="fl">*,score</str>
>>       <str name="facet">on</str>
>>       <str name="facet.field">participant</str>
>>       <str name="facet.field">decade</str>
>>       <str name="facet.field">timeweek</str>
>>       <str name="facet.field">cat</str>
>>       <str name="facet.field">maincat</str>
>>       <str name="facet.field">channel_name</str>
>>       <str name="facet.mincount">1</str>
>>     </lst>
>>  </requestHandler>
> 

Re: Custom SearchHandler using existing DismaxRequestHandler

Posted by Erik Hatcher <er...@gmail.com>.
Chantal -

You'll have to copy the configuration to your various handlers.

However, with the VelocityResponseWriter, you can use your existing  
handlers and simply set wt=velocity on them by default, or set it from  
the client with &wt=velocity appended to the query string.   The  
VelocityResponseWriter will look for templates based on the request  
handler name (qt parameter), so <requestHandler name="dismax"> with  
wt=velocity will default to looking for a dismax.vm template for  
rendering.

	Erik

On Jan 8, 2010, at 8:23 AM, Chantal Ackermann wrote:

> Dear all,
>
> happy New Year!
>
> For my custom searchHandler (called /list) that uses the  
> VelocityResponseWriter I would like to use the existing dismax  
> configuration. Therefore I did NOT specify ANY dismax configuration  
> in that custom handler.
>
> In short: it's not using (my existing) dismax at all, as it seems.
> It only returns results for no parameters, using q.alt=*:* (defined  
> in solrconfig.xml), or for q=field:value (even if dismax is default,  
> and qt is missing).
>
> Question: Is there a way to reference the existing dismax handler  
> (=avoid copying of the existing configuration)?
> (I couldn't find anything helpful in the wiki or the mailing lists.  
> Maybe it's too obvious...?)
>
> What I tried and did not work is the "qt" parameter. (This probably  
> also requires it's own dismax configuration). Other variants of  
> configuration I have marked with brackets in the pasted config below.
>
>
> Thanks for your time!
> Chantal
>
>
>
> Configuration of dismax and the custom search handler (in brackets  
> the different config variants I tried):
>
> <requestHandler name="dismax"  
> class="solr.SearchHandler" [default="true"]>
> 	<lst name="defaults">
> 		<str name="defType">dismax</str>
> 		<str name="echoParams">explicit</str>
> 		<float name="tie">0.01</float>
> 		<str name="qf"> ...fields... </str>
> 		<str name="pf"> ...fields... </str>
> 		<str name="fl"> *,score </str>
> 		<str name="mm"> 2&lt;-1 5&lt;80%</str>
> 		<int name="ps">100</int>
> 		<str name="q.alt">*:*</str>
>    	</lst>
> </requestHandler>
>
>  <requestHandler name="/list" class="solr.SearchHandler">
>     <lst name="defaults">
>       <str name="v.template">listView</str>
>       <str name="v.properties">velocity.properties</str>
>       <str name="v.contentType">text/html;charset=UTF-8</str>
>       <str name="title">Suchergebnisse</str>
>
>       <str name="wt">velocity</str>
>       [<str name="defType">dismax</str>]
>       [<str name="qt">dismax</str>]
>       [<str name="q.alt">*:*</str>]
>       <str name="sort">score desc,start_date asc</str>
>       <str name="rows">20</str>
>       <str name="fl">*,score</str>
>       <str name="facet">on</str>
>       <str name="facet.field">participant</str>
>       <str name="facet.field">decade</str>
>       <str name="facet.field">timeweek</str>
>       <str name="facet.field">cat</str>
>       <str name="facet.field">maincat</str>
>       <str name="facet.field">channel_name</str>
>       <str name="facet.mincount">1</str>
>     </lst>
>  </requestHandler>