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 Jochen Just <jo...@avono.de> on 2012/06/01 14:48:25 UTC

Sharing common config between different search handlers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey there list,

my application needs two searching modes. The first modes needs to
consider synonyms the other one must not.

Currently I have two field types with basically the same configuration
except that one field type uses a SynonymFilter the other one doesn't.
Furthermore there two Searchhandlers. The first one uses only fields
that recognises synonyms the other one uses only fields that doesn't
recognise synonyms.
So far, so good.

But I would like those two Searchhandlers to share the rest of their
configuration. Because if anything needs to be changed, it need to be
done for both Searchhandlers. I think that's kind of ugly.
Additionally I would like the client (the web page the triggers a
search) not to know anything about the field names. Therefore I do not
simply specify a list of query fields in the request.

To clarify my situation, follows a sample solrconfig.xml (I left out
many of the details to save time and space, but I guess you get the idea).

<requestHandler name="/search_with_synonyms" class="solr.SearchHandler">
  <lst name="defaults">
    <str name="defType">edismax</str>
    <str name="rows">10</str>
    <str name="fl">id, score</str>
    <str name="qf">description_with_synonyms</str>
    <!-- a lot of other configuration happens here -->
  </lst>
</requestHandler>

<requestHandler name="/search_without_synonyms"
class="solr.SearchHandler">
  <lst name="defaults">
    <str name="defType">edismax</str>
    <str name="rows">10</str>
    <str name="fl">id, score</str>
    <str name="qf">description_without_synonyms</str>
    <!-- a lot of other configuration happens here -->
  </lst>
</requestHandler>

I thought about using only SearchHandler and a filterquery to get rid
of the "synonym-results" if they are not needed. But I as far as I can
tell, that's not possible.

Thanks in advance and any idea is welcome,

Jochen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPyLoZAAoJEP1xbhgWUHmS72oQAKbh5vr5SmROMO9Eupdfnr7c
2VNqQsPPslzVWSIRVsvsEZxW8RalWsXB33Dayqzqg+5Be0BSBnrwmCYGsMwetHCT
PQjXx9OvuxlGxFeRoLmrMbhDdKLudWPkHmcHK2t8ZTgZ7ZWBJOimNiYIJANHd5Wc
7C0SMqcmiyxA58RvVePtkcZP7ag7kq2CLlamd8hg7cDWs4FYR/4eRXZcgIg76Eoc
CnkgP5w0gRWxNbDI1y+KxvT4XX3lZ/w+Kwr5A7CK1WTm1Y+hrDc7cjNiUU4c/3a1
9kgnhUxTKlzLLeIPWe2qvtXqvgUcMg9l09oFnTQ+u58g+v7wBObEnCJi1IKT7gT3
+pA8kAFY8bAHauoeHg2XZO3PFtowMXXm1Er/5+euEeoRdlOAi9SPO5pCbRnlSAI8
u8QwFfXv3ZeYI4CFsQsFFUX/NVPJuVXerti0n3Ebn6sUXqs0EmxUmr5vpSnQ38Md
NQgdFRWeYeRD341Jy1tqyFh8gtzIUwWA5Otd7tKR//xidhrnq5CCA8kOr+i3AnT/
4w04ite1uGd+m5erspcBR6SkxtLVcSp3rcpzSV0CC2j5vQdxe6b8PBy25cowaxJF
wOtrtyPisvwWMM253GMuO4O6uxv+p/SgP1gdiZ4I9ZMQQwlT/Ny7+APEj93eNrKQ
3Y38BDWKUio30/yThe9G
=4mQ9
-----END PGP SIGNATURE-----

Re: Sharing common config between different search handlers

Posted by Chris Hostetter <ho...@fucit.org>.
: But I would like those two Searchhandlers to share the rest of their
: configuration. Because if anything needs to be changed, it need to be
: done for both Searchhandlers. I think that's kind of ugly.

take a look at using XML includes (aka "xinclude") ... that would let you 
keep the common child elements in a disintct file that would be included.



-Hoss