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 8460073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:30:23+00:00 2026-06-10T13:30:23+00:00

I am using a library ( Solarium for Solr), and the results returned by

  • 0

I am using a library (Solarium for Solr), and the results returned by it is in a format that I am not familiar with. The chunk of code below shows the output of print_r($resultset) on the results $resultset returned by the library’s function.

I would like it to be in a format (maybe array?) where I massage the data further, and convert it into the final format JSON. How can I do that? json_encode($resultset) just gave me an empty JSON string {}.

Data in original format

Solarium_Result_Select Object
(
    [_numfound:protected] => 
    [_documents:protected] => 
    [_components:protected] => 
    [_status:protected] => 
    [_queryTime:protected] => 
    [_parsed:protected] => 
    [_response:protected] => Solarium_Client_Response Object
        (
            [_headers:protected] => Array
                (
                    [0] => HTTP/1.1 200 OK
                    [1] => Server: Apache-Coyote/1.1
                    [2] => Content-Type: text/plain;charset=UTF-8
                    [3] => Date: Fri, 17 Aug 2012 17:21:14 GMT
                    [4] => Connection: close
                )

            [_body:protected] => {"responseHeader":{"status":0,"QTime":0,"params":{"fl":"*,score","start":"0","q":"*:*","wt":"json","rows":"2"}},"response":{"numFound":232,"start":0,"maxScore":1.0,"docs":[{"id":"1045","title":"White dress","description":"Ohhh its white omg fav color","score":1.0},{"id":"1046","title":"Darker tones","description":"Man this looks scary, the ring? Ultra fast transfer speeds: Armor A80's outstanding read/write speed is coupled with the latest USB 3.0 interface and is backwards compatible with USB 2.0. The USB 3.0 interface features a 5 Gbps/sec bandwidth which is 10x the bandwidth of a USB 2.0 interface. It saves users precious time backing up to and from the hard drive when transferring mass data files. Water, pressure, vibration & dust proof.","score":1.0}]}}
            [_statusCode:protected] => 200
            [_statusMessage:protected] => OK
        )

    [_data:protected] => 
    [_query:protected] => Solarium_Query_Select Object
        (
            [_options:protected] => Array
                (
                    [handler] => select
                    [resultclass] => Solarium_Result_Select
                    [documentclass] => Solarium_Document_ReadOnly
                    [query] => *:*
                    [start] => 0
                    [rows] => 2
                    [fields] => *,score
                )

            [_componentTypes:protected] => Array
                (
                    [facetset] => Array
                        (
                            [component] => Solarium_Query_Select_Component_FacetSet
                            [requestbuilder] => Solarium_Client_RequestBuilder_Select_Component_FacetSet
                            [responseparser] => Solarium_Client_ResponseParser_Select_Component_FacetSet
                        )

                    [dismax] => Array
                        (
                            [component] => Solarium_Query_Select_Component_DisMax
                            [requestbuilder] => Solarium_Client_RequestBuilder_Select_Component_DisMax
                            [responseparser] => 
                        )

                    [morelikethis] => Array
                        (
                            [component] => Solarium_Query_Select_Component_MoreLikeThis
                            [requestbuilder] => Solarium_Client_RequestBuilder_Select_Component_MoreLikeThis
                            [responseparser] => Solarium_Client_ResponseParser_Select_Component_MoreLikeThis
                        )

                    [highlighting] => Array
                        (
                            [component] => Solarium_Query_Select_Component_Highlighting
                            [requestbuilder] => Solarium_Client_RequestBuilder_Select_Component_Highlighting
                            [responseparser] => Solarium_Client_ResponseParser_Select_Component_Highlighting
                        )

                    [grouping] => Array
                        (
                            [component] => Solarium_Query_Select_Component_Grouping
                            [requestbuilder] => Solarium_Client_RequestBuilder_Select_Component_Grouping
                            [responseparser] => Solarium_Client_ResponseParser_Select_Component_Grouping
                        )

                    [spellcheck] => Array
                        (
                            [component] => Solarium_Query_Select_Component_Spellcheck
                            [requestbuilder] => Solarium_Client_RequestBuilder_Select_Component_Spellcheck
                            [responseparser] => Solarium_Client_ResponseParser_Select_Component_Spellcheck
                        )

                    [distributedsearch] => Array
                        (
                            [component] => Solarium_Query_Select_Component_DistributedSearch
                            [requestbuilder] => Solarium_Client_RequestBuilder_Select_Component_DistributedSearch
                            [responseparser] => 
                        )

                    [stats] => Array
                        (
                            [component] => Solarium_Query_Select_Component_Stats
                            [requestbuilder] => Solarium_Client_RequestBuilder_Select_Component_Stats
                            [responseparser] => Solarium_Client_ResponseParser_Select_Component_Stats
                        )

                    [debug] => Array
                        (
                            [component] => Solarium_Query_Select_Component_Debug
                            [requestbuilder] => Solarium_Client_RequestBuilder_Select_Component_Debug
                            [responseparser] => Solarium_Client_ResponseParser_Select_Component_Debug
                        )

                )

            [_fields:protected] => Array
                (
                    [*] => 1
                    [score] => 1
                )

            [_sorts:protected] => Array
                (
                )

            [_filterQueries:protected] => Array
                (
                )

            [_components:protected] => Array
                (
                )

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

        )

    [_client:protected] => Solarium_Client Object
        (
            [_options:protected] => Array
                (
                    [adapter] => Solarium_Client_Adapter_Http
                    [adapteroptions] => Array
                        (
                            [host] => 127.0.0.1
                            [port] => 8080
                            [path] => /solr/
                        )

                )

            [_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] => Solarium_Client_Adapter_Http Object
                (
                    [_options:protected] => Array
                        (
                            [host] => 127.0.0.1
                            [port] => 8080
                            [path] => /solr
                            [core] => 
                            [timeout] => 5
                        )

                )

            [_requestBuilders:protected] => 
        )

)

PHP Code

public function action_search() {

    Solarium_Autoloader::register();
    $client = new Solarium_Client();

    $query = $client
                ->createSelect()
                ->setRows(2);

    $resultset = $client->select($query);

    echo "<pre>";
    print_r($resultset);

    $result = json_encode($resultset);
    echo $result;
  • 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-10T13:30:24+00:00Added an answer on June 10, 2026 at 1:30 pm

    Based on the Solarium docs, I’d try something like this:

    /*...*/
    $resultset = $client->select($query);
    
    $results = array();
    foreach($resultset as $document) {
        $item = array();
        foreach($document as $field => $value) {
            $item[$field] = $value;
        }
        $results[] = $item;
    }
    echo json_encode($results);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a library that generates code based on IDL definitions. Its great
Using Enterprise Library 3.1, I have a logger that, once it reaches its rollSizeKB
I am using ipod library for my applicatio, But the Song Choice is not
I using library of Zend Framework and code php (no using struct zend, only
I am using a library that that handles a variety of tasks related to
I'm using this library: PB for ObjC http://code.google.com/p/metasyntactic/wiki/ProtocolBuffers . The problem is I can't
The code was to copy and concatenate strings widout using library functions.the code i
I am using cardme library to deal with vcards. Following is my code package
I have integrated Facebook using library in my previous application and it works fine
using stdout library it will maybe pass data to logcat or somewhere else which

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.