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 Paul Libbrecht <pa...@hoplahup.net> on 2011/03/08 22:46:42 UTC

two QueryHandler components in one schema?

hello list,

in my schema I have 

    <searchComponent name="query"
                     class="org.curriki.solr.handlers.CurrikiSolrQueryComponent" />

which, as I understand it, allows all requestHandlers to use my query-component. That is useful but I wonder if there's a way for me to have one request-handler that uses my query-component and another to use the default one?

Formulated, differently, my question is whether 
- search-components can be defined by name within the requestHandler element of the schema
- or whether a differently named query search-component would still be used as query-component

thanks in advance

paul

Re: two QueryHandler components in one schema?

Posted by Chris Hostetter <ho...@fucit.org>.
: did you, Hoss, not say that components are referred to by name? How 
: could the search result be read from the query mySpecialQueryComponent 
: if it cannot be named? Simply through the pool of SolrParams?

in the example i gave, "mySpecialQueryComponent" *is* the name of some 
component you have already defined -- instead of using the component named 
"query" which has also already been defined (either implicitly as a 
default or explicitly in the config)

As i keep saying: if you look at the 1.4.1 example solrconfig.xml, there 
are several examples of this (and the example solrconfig.xml that will be 
in the Solr 3.1 is even better)...

>From 1.4.1...

   By default, the following components are avaliable:
    
   <searchComponent name="query"     
   class="org.apache.solr.handler.component.QueryComponent" />

	...
   
   Default configuration in a requestHandler would look like:
    <arr name="components">
      <str>query</str>
      <str>facet</str>
      <str>mlt</str>
      <str>highlight</str>
      <str>stats</str>
      <str>debug</str>
    </arr>

    If you register a searchComponent to one of the standard names, that 
    will be used instead. 

	...

  <!-- A component to return terms and document frequency of those terms.
       This component does not yet support distributed search. -->
  <searchComponent name="termsComponent" 
  class="org.apache.solr.handler.component.TermsComponent"/>

  <requestHandler name="/terms" 
  class="org.apache.solr.handler.component.SearchHandler">
     <lst name="defaults">
      <bool name="terms">true</bool>
    </lst>     
    <arr name="components">
      <str>termsComponent</str>
    </arr>
  </requestHandler>



-Hoss

Re: two QueryHandler components in one schema?

Posted by Paul Libbrecht <pa...@hoplahup.net>.
Erm,

did you, Hoss, not say that components are referred to by name?
How could the search result be read from the query mySpecialQueryComponent if it cannot be named? Simply through the pool of SolrParams?

If yes, that's the great magic of solr.

paul


Le 8 mars 2011 à 23:19, Chris Hostetter a écrit :

> ...so if you don't wnat to use "query" and you want to use 
> "mySpecialQueryComponent" it would be ...
> 
>   <arr name="components">
>     <str>mySpecialQueryComponent</str>
>     <str>facet</str>
>     <str>mlt</str>
>     <str>highlight</str>
>     <str>debug</str>
>   </arr>
> 
> ...the SearchComponent URL i sent, as well as the 
> example/solr/conf/solrconfig.xml file that ships with solr also has 
> examples of how/when you can specify an explicit components list


Re: two QueryHandler components in one schema?

Posted by Chris Hostetter <ho...@fucit.org>.
: So how do I define, for a given request-handler, a special query component?
: I did not find in this in the schema.

you mean solrocnfig.xml, again.

Taken directly from the SearchHandler URL i sent you...

> If you want to have a custom list of components (either omitting 
> defaults or adding custom components) you can specify the components for 
> a handler directly:
> 
>    <arr name="components">
>      <str>query</str>
>      <str>facet</str>
>      <str>mlt</str>
>      <str>highlight</str>
>      <str>debug</str>
>      <str>someothercomponent</str>
>    </arr>

...so if you don't wnat to use "query" and you want to use 
"mySpecialQueryComponent" it would be ...

   <arr name="components">
     <str>mySpecialQueryComponent</str>
     <str>facet</str>
     <str>mlt</str>
     <str>highlight</str>
     <str>debug</str>
   </arr>

...the SearchComponent URL i sent, as well as the 
example/solr/conf/solrconfig.xml file that ships with solr also has 
examples of how/when you can specify an explicit components list



-Hoss

Re: two QueryHandler components in one schema?

Posted by Markus Jelsma <ma...@openindex.io>.
A request handler can have first-components and last-components and also just 
plain components. List all your stuff in components and voila. Don't forget to 
also add debug, facet and other default components if you need them.

> Le 8 mars 2011 à 23:03, Chris Hostetter a écrit :
> > : in my schema I have
> > 
> > First off, a bit of terminoligy clarification: Search COmponents are
> > declarred in the solrconfig.xml file.  schema.xml is where you define
> > what, inherently, the data in your index *is*.  solrocnfig.xml is where
> > you define how you want people to be able to interact with the data in
> > your index.
> 
> Sorry, this is absolutely true. I should have said "in my config".
> 
> > : Formulated, differently, my question is whether
> > : - search-components can be defined by name within the requestHandler
> > : element of the schema - or whether a differently named query
> > : search-component would still be used as query-component
> > 
> > yes, and yes.
> > 
> > SearchHandler refrences Search Components by name, using the component
> > list it is configured with.  So you can leave the name "query" for the
> > default instance of QueryComponent and then give your custom component
> > it's own name, and refer to it by name when configuring the
> > SearchHandler's you want to use it...
> 
> So how do I define, for a given request-handler, a special query component?
> I did not find in this in the schema.
> 
> paul

Re: two QueryHandler components in one schema?

Posted by Paul Libbrecht <pa...@hoplahup.net>.
Le 8 mars 2011 à 23:03, Chris Hostetter a écrit :

> : in my schema I have 
> 
> First off, a bit of terminoligy clarification: Search COmponents are 
> declarred in the solrconfig.xml file.  schema.xml is where you define 
> what, inherently, the data in your index *is*.  solrocnfig.xml is where 
> you define how you want people to be able to interact with the data in 
> your index.

Sorry, this is absolutely true. I should have said "in my config".

> : Formulated, differently, my question is whether 
> : - search-components can be defined by name within the requestHandler element of the schema
> : - or whether a differently named query search-component would still be used as query-component
> 
> yes, and yes.
> 
> SearchHandler refrences Search Components by name, using the component 
> list it is configured with.  So you can leave the name "query" for the 
> default instance of QueryComponent and then give your custom component 
> it's own name, and refer to it by name when configuring the 
> SearchHandler's you want to use it...

So how do I define, for a given request-handler, a special query component?
I did not find in this in the schema.

paul

Re: two QueryHandler components in one schema?

Posted by Chris Hostetter <ho...@fucit.org>.
: in my schema I have 

First off, a bit of terminoligy clarification: Search COmponents are 
declarred in the solrconfig.xml file.  schema.xml is where you define 
what, inherently, the data in your index *is*.  solrocnfig.xml is where 
you define how you want people to be able to interact with the data in 
your index.

: Formulated, differently, my question is whether 
: - search-components can be defined by name within the requestHandler element of the schema
: - or whether a differently named query search-component would still be used as query-component

yes, and yes.

SearchHandler refrences Search Components by name, using the component 
list it is configured with.  So you can leave the name "query" for the 
default instance of QueryComponent and then give your custom component 
it's own name, and refer to it by name when configuring the 
SearchHandler's you want to use it...

	http://wiki.apache.org/solr/SearchHandler
	http://wiki.apache.org/solr/SearchComponent




-Hoss