Emanuel
Emanuel

Reputation: 16

Configure RequestHandler Between 2 Solr Shards

I have 2 shards :

I can query both shards with : "http://localhost:8983/solr/core1/selectq=:&indent=true&shards=127.0.0.1:8983/solr/core1,127.0.0.1:8984/solr/core1&fl=id,name&wt=xml"

Response :

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">1</int>
  <lst name="params">
    <str name="q">*:*</str>
    <str name="fl">id,name</str>
    <str name="wt">xml</str>
  </lst>
</lst>
<result name="response" numFound="1" start="0" numFoundExact="true">
  <doc>
    <str name="id">3007WFP</str>
    <str name="name">Dell Widescreen UltraSharp 3007WFP</str></doc>
  <doc>
    <str name="id">VA902B</str>
    <str name="name">ViewSonic VA902B - flat panel display - TFT -19</str></doc>
</result>
</response>

I want to query just the first shard and receive response from both. "Rather than require users to include the shards parameter explicitly, it is usually preferred to configure this parameter as a default in the RequestHandler section of solrconfig.xml."

Shard 1 (Query/ Response)

curl "http://localhost:8983/solr/core1/selectq=*:*&fl=id,name&wt=xml"

<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">1</int>
  <lst name="params">
    <str name="q">*:*</str>
    <str name="fl">id,name</str>
    <str name="wt">xml</str>
  </lst>
</lst>
<result name="response" numFound="1" start="0" numFoundExact="true">
  <doc>
    <str name="id">3007WFP</str>
    <str name="name">Dell Widescreen UltraSharp 3007WFP</str></doc>
</result>
</response>

Shard 2 (Query/ Response)

curl "http://localhost:8984/solr/core1/select?q=*:*&fl=id,name&wt=xml"
<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">1</int>
  <lst name="params">
    <str name="q">*:*</str>
    <str name="fl">id,name</str>
    <str name="wt">xml</str>
  </lst>
</lst>
<result name="response" numFound="1" start="0" numFoundExact="true">
  <doc>
    <str name="id">VA902B</str>
    <str name="name">ViewSonic VA902B - flat panel display - TFT - 19"</str></doc>
</result>
</response>

After adding to the first Node (solrconfig.xml):

<requestHandler name="/selectdistributed" class="solr.SearchHandler">
    <lst name="defaults">
        <str name="echoParams">explicit</str>
        <int name="rows">10</int>
        <str name="df">text</str>
        <str name="shards">127.0.0.1:8983/solr/core1,127.0.0.1:8984/solr/core1</str>
    </lst>
</requestHandler>

The following query is only returning the document from the first node and not from both nodes as expected.

curl "http://localhost:8983/solr/core1/selectq=:&fl=id,name&wt=xml"

<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">1</int>
  <lst name="params">
    <str name="q">*:*</str>
    <str name="fl">id,name</str>
    <str name="wt">xml</str>
  </lst>
</lst>
<result name="response" numFound="1" start="0" numFoundExact="true">
  <doc>
    <str name="id">3007WFP</str>
    <str name="name">Dell Widescreen UltraSharp 3007WFP</str></doc>
</result>
</response>

Is there something else i need to add ? Thanks

Upvotes: 0

Views: 93

Answers (1)

MatsLindh
MatsLindh

Reputation: 52892

You're defining your new requestHandler with a path of /selectdistributed, but you're still querying /select:

<requestHandler name="/selectdistributed" class="solr.SearchHandler">
                      ^^^^^^^^^^^^^^^^^^

Your curl command:

curl "http://localhost:8983/solr/core1/select?q=*:*&fl=id,name&wt=xml"
                                       ^^^^^^

So you're still querying against the old endpoint, not the new one you have defined.

Upvotes: 0

Related Questions