Addinall
Addinall

Reputation: 349

Solr Solaruim Client->ping is failing

I am new to this stuff. I just inherited this olde system! I managed to get Solr running, and am trying to execute some old code that rebuilds the Solr data. The client ping is failing and I don't understand why.

Here is the code that is trying to initiate a re-index

// these are correct, now Solarium is falling over
// with a 404.  pile of junk

print(SOLR_SERVER_HOSTNAME . "\n");
print(SOLR_SERVER_PORT . "\n");
print(SOLR_SERVER_CORE . "\n");

            $options = array(
                'adapteroptions' => array(
                    'host' => SOLR_SERVER_HOSTNAME,
                    'port' => SOLR_SERVER_PORT,
                    'core' => SOLR_SERVER_CORE,
                    'timeout' => 60
                )
            );
        }

        try {
            // Ping the Solr server to check its availability


        // create a new client.  This seems to work
            $this->client = new Solarium_Client($options);
        if ($this->client) {
        print("Solarium returned something \n");
        print_r($this->client);
        print("\n");
            } else {
        echo 'Solarium screwed the pooch';
            }


        // and create a ping whatever that means
        // this also seems to work

            $ping = $this->client->createPing();
        if ($ping) {
        print("ping creation worked \n");
        print_r($ping);
        } else {
        print("ping creation failed \n");
        }

        // this always fails and terminate the
            // program run

            $this->client->ping($ping);

        } catch (Solarium_Exception $e) {
        print("exeption from ping request \n");
            throw $e;
        }

    print("about to reset \n");

        // Reset all filters and queries and process request params if requested
        $this->reset($request);
    }

The Solr admin screen is up. I have an empty collection1..

Here is the output from the trace I stuck in here

1/tmp/reindex.lock
15/01/18 17:38:54 [INFO] Index started

 Index started 
localhost
9999
collection1
Solarium returned something 
Solarium_Client Object
(
    [_options:protected] => Array
        (
            [adapter] => Solarium_Client_Adapter_Http
            [adapteroptions] => Array
                (
                    [host] => localhost
                    [port] => 9999
                    [core] => collection1
                    [path] => /solr/
                    [timeout] => 60
                )

        )

    [_queryTypes:protected] => Array
        (
            [select] => Array
                (
                    [query] => Solarium_Query_Select
                    [requestbuilder] => Solarium_Client_RequestBuilder_Select
                    [responseparser] => Solarium_Client_ResponseParser_Select
                )

            [update] => Array
                (
                    [query] => Solarium_Query_Update
                    [requestbuilder] => Solarium_Client_RequestBuilder_Update
                    [responseparser] => Solarium_Client_ResponseParser_Update
                )

            [ping] => Array
                (
                    [query] => Solarium_Query_Ping
                    [requestbuilder] => Solarium_Client_RequestBuilder_Ping
                    [responseparser] => Solarium_Client_ResponseParser_Ping
                )

            [mlt] => Array
                (
                    [query] => Solarium_Query_MoreLikeThis
                    [requestbuilder] => Solarium_Client_RequestBuilder_MoreLikeThis
                    [responseparser] => Solarium_Client_ResponseParser_MoreLikeThis
                )

            [analysis-document] => Array
                (
                    [query] => Solarium_Query_Analysis_Document
                    [requestbuilder] => Solarium_Client_RequestBuilder_Analysis_Document
                    [responseparser] => Solarium_Client_ResponseParser_Analysis_Document
                )

            [analysis-field] => Array
                (
                    [query] => Solarium_Query_Analysis_Field
                    [requestbuilder] => Solarium_Client_RequestBuilder_Analysis_Field
                    [responseparser] => Solarium_Client_ResponseParser_Analysis_Field
                )

            [terms] => Array
                (
                    [query] => Solarium_Query_Terms
                    [requestbuilder] => Solarium_Client_RequestBuilder_Terms
                    [responseparser] => Solarium_Client_ResponseParser_Terms
                )

            [suggester] => Array
                (
                    [query] => Solarium_Query_Suggester
                    [requestbuilder] => Solarium_Client_RequestBuilder_Suggester
                    [responseparser] => Solarium_Client_ResponseParser_Suggester
                )

        )

    [_pluginTypes:protected] => Array
        (
            [loadbalancer] => Solarium_Plugin_Loadbalancer
            [postbigrequest] => Solarium_Plugin_PostBigRequest
            [customizerequest] => Solarium_Plugin_CustomizeRequest
            [parallelexecution] => Solarium_Plugin_ParallelExecution
            [bufferedadd] => Solarium_Plugin_BufferedAdd
            [prefetchiterator] => Solarium_Plugin_PrefetchIterator
        )

    [_pluginInstances:protected] => Array
        (
        )

    [_adapter:protected] => 
    [_requestBuilders:protected] => 
)

ping creation worked 
Solarium_Query_Ping Object
(
    [_options:protected] => Array
        (
            [resultclass] => Solarium_Result_Ping
            [handler] => admin/ping
        )

    [_helper:protected] => 
    [_params:protected] => Array
        (
        )

)
exeption from ping request 
Failed to initialise Solr client: 
Solr HTTP error: Not Found (404)
Failed to initialise Solr client: Solr HTTP error: Not Found (404)

Any hints? It's the first time I have seen this stuff.

Cheers, Mark.

Upvotes: 0

Views: 522

Answers (1)

Addinall
Addinall

Reputation: 349

Fixed. The core name was getting flattened in another bit of code. Two constants for the same property. Two different values! – Addinall 22 secs

Upvotes: 0

Related Questions