Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8672403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:11:42+00:00 2026-06-12T19:11:42+00:00

What my problem is that I can not send array to solr machine in

  • 0

What my problem is that I can not send array to solr machine in order to update. I am using codeigniter as a framework and here is my code:

            $solrData = array();

            $solrData['id']                 = $this->data['profil_data']['id'];
            $solrData['site']               = $this->data['profil_data']['site'];
            $solrData['url_Domain']         = $this->data['profil_data']['url_Domain'];
            $solrData['url_Page']           = $this->data['profil_data']['url_Page'];
            $solrData['url_Profil']         = $this->data['profil_data']['url_Profil'];
            $solrData['scr_Kobi_Rank']      = $this->data['profil_data']['scr_Kobi_Rank'];
            $solrData['scr_A']              = $this->data['profil_data']['scr_A'];
            $solrData['scr_B']              = $this->data['profil_data']['scr_B'];
            $solrData['scr_C']              = $this->data['profil_data']['scr_C'];
            $solrData['scr_D']              = $this->data['profil_data']['scr_D'];
            $solrData['loc_City']           = $this->input->post('plakano');
            $solrData['loc_Lat_Lon']        = $this->input->post('loc_Lat_Lon');
            $solrData['com_Category']       = explode(',', $this->input->post('category'));         

            $urunData   = $this->input->post('urun_list');

            foreach($urunData as $row)
            {
                $ontoData = $this->m_onto->getOntoDataByOntoDataId($row);
                $solrData['com_Products'][] = $ontoData['baslik'];
            }

            $hizmetData = $this->input->post('hizmet_list');

            foreach($hizmetData as $row)
            {
                $ontoData = $this->m_onto->getOntoDataByOntoDataId($row);
                $solrData['com_Services'][] = $ontoData['baslik'];
            }

            $solrData['com_Type']           = $this->input->post('sirketturu');
            $solrData['com_Description']    = $this->input->post('description');
            $solrData['com_Title_Selected'] = $this->input->post('title');
            $solrData['com_Title_Long']     = $this->data['profil_data']['com_Title_Long'];
            $solrData['crm_Tel']            = $this->input->post('tel');
            $solrData['crm_Fax']            = $this->input->post('fax');
            $solrData['crm_Email']          = $this->input->post('email');

            $this->solr->updateSolrProfilData($solrData);

And solr process:

public function updateSolrProfilData($arrData)
{
    if(count($arrData) == 0)
        return FALSE;

    $solrClientOptions          = $this->solrClientOptionsYazProfil;    
    $solrClientOptionsCommit    = $this->solrClientOptionsYazProfilCommit;

    $solrClient = new SolrClient($solrClientOptions);       
    $solrDoc    = new SolrInputDocument();

    foreach($arrData as $firmaField => $firmaValue)
    {
        if(! is_array($firmaValue))
        {
            $solrDoc->addField($firmaField, $firmaValue);
        }
        else
        {
            foreach($firmaValue as $firmaField2 => $firmaValue2)
            {
                if($firmaValue2 != '')
                {
                    $solrDoc->addField($firmaField, $firmaValue2);
                }
            }
        }
    }

    try {
        $this->_solrCommit($solrClientOptionsCommit);
    } catch (Exception $e) {
        echo $e->getMessage(); 
    }           
}

Solr Commit function:

private function _solrCommit($solrArr)
{
    $urlCommit  = 'http://' . $solrArr['hostname'] . ":" . $solrArr['port'] . '/' . $solrArr['path'] . "/update?stream.body=%3Ccommit/%3E&wt=json";

    $output     = file_get_contents($urlCommit);
    $outputArr  = json_decode($output, TRUE);

    if ($outputArr['responseHeader']['status'] ===  0)
        return TRUE;
    else
        return FALSE;
}

And that is the options:

private $solrClientOptionsYazProfilCommit = array(
                                'hostname' => SOLR_HOST_YAZ,
                                'login'    => '',
                                'password' => '',
                                'port'     => SOLR_PORT,
                                'path'     => 'solr/collection1'
);

Altough try-catch returns no error, the data can not be updated. Moreover, code sends solr commit succesfully. I checked the url but it is in correct form. What is wrong in here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:11:43+00:00Added an answer on June 12, 2026 at 7:11 pm

    Dont use PHP/Pecl solr libs. If you can access solr via a URL then you should just use PHP and CURL:

    static function doCurl($url, $username = null, $password = null) {
        if (!function_exists('curl_init')) {
            // throw error
        }
    
        $ch = curl_init();
        $opts = array(
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_POST => 1,
            CURLOPT_TIMEOUT => 120,
            CURLOPT_FAILONERROR => 1,
            CURLOPT_HTTPAUTH => CURLAUTH_ANY
        );
    
        if ($password != null && $username != null) {
            $opts[CURLOPT_USERPWD] = "$username:$password";
        }
    
        curl_setopt_array($ch, $opts);
        $response = curl_exec($ch);
        curl_close($ch);
        return $response;
    }
    

    usage is:
    doCurl(“http://hostNameHere:8983/solr/select/?q=solr&start=0&rows=10&indent=on”, “user”, “pass”);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I faced a problem that I can not find a way to change the
Assuming that parsing the equation would not be a problem, how can I make
I can make a log in for easily, so that's not the problem. What
I have some PHP code that I'm using to send a form off to
So, I as I understand, my problem is that file_get_contents() does not send proper
I modified the code here (http://www.w3schools.com/PHP/php_ajax_database.asp) to update and display my database after an
My problem is that I don't know how to send the data that I
using ExtJS 3 here. I just noticed (in reply to my previous question) that
I've always wanted to send objects that you can serialize in XML across websites,
I am having an interesting problem using Monodroid to send commands to a device

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.