#016195: Errors when searching with Solr

Description:

Followed the Solr Tutorial as given here to set it up:
http://lucene.apache.org/solr/tutorial.htmlurl

Replaced the example/solr/conf/schema.xml with the one one linked to from here: http://www.ezcomponents.org/docs/tutorials/Search#id1url

Indexing produced no errors and it appears that there are results going through the Solr Administration.

Trying to run a search query through the search system produces the following errors:

ezcomponents/Search/handlers/solr.php on line 442: Trying to get property of non-object
ezcomponents/Search/handlers/solr.php on line 442: Trying to get property of non-object
ezcomponents/Search/handlers/solr.php on line 443: Trying to get property of non-object
ezcomponents/Search/handlers/solr.php on line 443: Trying to get property of non-object
ezcomponents/Search/handlers/solr.php on line 444: Trying to get property of non-object
ezcomponents/Search/handlers/solr.php on line 444: Trying to get property of non-object
ezcomponents/Search/handlers/solr.php on line 445: Trying to get property of non-object
ezcomponents/Search/handlers/solr.php on line 445: Trying to get property of non-object
ezcomponents/Search/handlers/solr.php on line 447: Trying to get property of non-object
ezcomponents/Search/handlers/solr.php on line 447: Trying to get property of non-object
ezcomponents/Search/handlers/solr.php on line 447: Invalid argument supplied for foreach()


Environment:

Operating System: Windows
PHP Version: 5.3.1
Solr Version: 1.4.0
Java Version: 6 u18


- Attachments

No attachments for this issue.


- Comments

The test cases run fine against the most recent versions of Solr 1.3 and 1.4, setup the way you referenced.

I can see from the code what probably goes wrong (the response is probably somehow broken), but I require a reproducing example to check what exactly happens in your case. Can you provide such?

#264716 by Kore Nordmann on February 17th, 2010 [Permanent Link]

The class I am using for interaction with the ezc search system (the article class is at the bottom):
http://pastebin.com/m645802d7url

The code I used to search:
$results = titania_search::search('test');

#264748 by Nathan Guse on February 17th, 2010 [Permanent Link]

Executing this code, I still get no error - most likely because there is nothing in the index. Please provide a minimal working reproducing script, without external dependencies.

#264756 by Kore Nordmann on February 18th, 2010 [Permanent Link]

http://pastebin.com/m21f3e3deurl

Should work with only adding your own auto-loader to the top

#264839 by Nathan Guse on February 21st, 2010 [Permanent Link]

I still can't reproduce the issue.

Your code executes just fine providing me one result, as expected. (Using PHP 5.3.1, Solr 1.4.0 and Java 1.6 (tried Sun VM & OpenJDK)

Can you ensure you are using the schema.xml properly and maybe clear the Solr-storage, since there might be some documents in there, which resulted from before adding the schema.xml?

I tried to index without our schema, and indexing again with our schema, and still don't get that error. Do you have more hints what you did to cause that behaviour - I would really like to be able to reproduce that bug, to fix it properly.

#264867 by Kore Nordmann on February 24th, 2010 [Permanent Link]

I copied the schema.xml file that the tutorial says to example/solr/conf/schema.xml from the example the solr site has.

I tried setting up a fresh copy of Solr with the same issue.

Backtracking a bit I went to the Search/handlers/solr.php file and in the search function, after the sendRawGetCommand call, this is what is returned:

<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">0</int><lst name="params"><str name="amp;df"/><str name="amp;fl">score id_t type_l title_t text_t text_uid_s text_bitfield_s text_options_l author_l date_l url_s access_level_l approved_l reported_l ezcsearch_type_s score</str><str name="q">ezcsearch_type_s:titania_article AND ( title_t:asdfasdf^2 OR text_t:asdfasdf )</str><str name="amp;hl.snippets">3</str><str name="amp;hl.simple.pre">&lt;b&gt;</str><str name="amp;start">0</str><str name="amp;wt">json</str><str name="amp;hl.fl">title_t text_t</str><str name="amp;hl">true</str><str name="amp;hl.simple.post">&lt;/b&gt;</str><str name="amp;rows">10</str></lst></lst><result name="response" numFound="1" start="0"><doc><arr name="access_level_l"><long>2</long></arr><arr name="approved_l"><long>0</long></arr><arr name="author_l"><long>2</long></arr><arr name="date_l"><long>1267059940</long></arr><arr name="ezcsearch_type_s"><str>titania_article</str></arr><str name="id">1_15467</str><arr name="id_t"><str>1_15467</str></arr><arr name="reported_l"><long>0</long></arr><arr name="text_bitfield_s"><str/></arr><arr name="text_options_l"><long>7</long></arr><arr name="text_t"><str>asdfasdf</str></arr><arr name="text_uid_s"><str/></arr><date name="timestamp">2010-02-25T01:05:40.917Z</date><arr name="title_t"><str>qwerasdf</str></arr><arr name="type_l"><long>1</long></arr><arr name="url_s"><str>mod/qwerasdf/</str></arr></doc></result>

</response>

After $result = json_decode( $result );
$result is NULL

EDIT: <code></code> seems not to be working...

#264880 by Nathan Guse on February 25th, 2010 [Permanent Link]

It looks like Solr uses its default XML response format in your case, instead of JSON, what we tell Solr to use. Can you provide me with a dump of the query parameters, in the sendRawGetCommand() method, like:


Index: handlers/solr.php
===================================================================
--- handlers/solr.php    (revision 11406)
+++ handlers/solr.php    (working copy)
@@ -172,6 +172,7 @@
      */
     public function sendRawGetCommand( $type, $queryString = array() )
     {
+        var_dump( $queryString );
         $statusCode = 0;
         $queryPart = '';
         if ( count( $queryString ) )

PS.: The code must be in lines without any other contents for the WIT markup parser. It is quite "strict" in that regard.

#265108 by Kore Nordmann on March 5th, 2010 [Permanent Link]

The important parameter I am looking for is the "wt" => "json" part:


array(6) {
  ["q"]=>
  string(63) "ezcsearch_type_s:Document AND ( title_s:Test^2 OR body_t:Test )"
  ["wt"]=>
  string(4) "json"
  ["df"]=>
  string(0) ""
  ["fl"]=>
  string(41) "score id_s title_s ezcsearch_type_s score"
  ["start"]=>
  int(0)
  ["rows"]=>
  int(999999)
}
#265109 by Kore Nordmann on March 5th, 2010 [Permanent Link]

array(11) {
["q"]=>
string(89) "ezcsearch_type_s:titania_article AND ( title_t:test^2 OR text_t:test ) AND approved_l:"1""
["wt"]=>
string(4) "json"
["df"]=>
string(0) ""
["fl"]=>
string(156) "score id_t type_l title_t text_t text_uid_s text_bitfield_s text_options_l author_l date_l url_s access_level_l approved_l reported_l ezcsearch_type_s score"
["hl"]=>
string(4) "true"
["hl.snippets"]=>
int(3)
["hl.fl"]=>
string(14) "title_t text_t"
["hl.simple.pre"]=>
string(3) "<b>"
["hl.simple.post"]=>
string(4) "</b>"
["start"]=>
int(0)
["rows"]=>
int(10)
}

#265132 by Nathan Guse on March 5th, 2010 [Permanent Link]

I have no idea why Solr would return XML instead of JSON in your case. Such cases are now handled and a ezcSearchInvalidResultException is thrown.

I guess it is either a Solr bug or misconfiguration (missing JSON encoder?) you are hitting. I have no idea what to do about that in ezcSearch except for "handling" this case by throwing an exception.

Thanks for your bug report, and feedback.

If you find the reason for Solr behaving in this way, please report back, so we can add a hint to the documentation.

#265371 by Kore Nordmann on March 19th, 2010 [Permanent Link]

You seem to have missed committing a new file when you fixed this as it's included in the autoloader but doesn't exist

Search/exceptions/invalid_result.php

#265521 by Nathan Guse on March 27th, 2010 [Permanent Link]

Was just playing around to see if I could find a way to fix this and the issue seems to be from using &amp; in $queryPart in sendRawGetCommand instead of &

#265522 by Nathan Guse on March 27th, 2010 [Permanent Link]

Reopened for the last two comments

#265562 by Nathan Guse on March 31st, 2010 [Permanent Link]

- History
Properties
Type Bug
Priority Medium
Component Components » Search
Affects Unknown
Fix Version -
Reporter Nathan Guse
Responsible Kore Nordmann
Status 0 Assigned
Resolution UNRESOLVED
Created February 15th, 2010
Updated March 31st, 2010
Resolved -
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels