Comments

JacobSingh’s picture

Assigned: Unassigned » JacobSingh
JacobSingh’s picture

StatusFileSize
new345.97 KB

Attached is the big patch (against 6.x) for upgrading the client. There are few changes to the actual module (just some variable names), but the class is quite different. This also uses the JSON response handler (unlike the previous version where we used the XML response handler).

In addition, there is also a new simpletest! (DrupalSolrMatchTestCase) DO NOT RUN IT ON A PRODUCTION SITE BECAUSE IT WIPES THE INDEX!

I highly recommend that everyone try the test out and confirm it works. It is modeled (ripped) from Steven Whitten's test for search.module in D7.

Here is how the test works:
1. Make sure there are no entries in the index
2. Insert a few documents (7) with a keywords where we are expecting a certain number of results
3. fire off the tests and ensure we get the same results
on tear down:
delete the index.

There is still work needed on the test to get it to use proper lucene syntax. At the moment, it is just doing basic keyword searching as per drupal syntax and therefore works most of the time, but I haven't really confirmed it.

Still, I think it is worth committing as long as others find it useful and we can add more robust queries to test / facet selection tests later on.

janusman’s picture

Uhm, just trying to understand this a bit more...

Are the attached patches against the SolrPhpClient directory *just* to sync it with the ZIP package (2008-09-02) here:

https://issues.apache.org/jira/browse/SOLR-341

...Or are there other changes that are bit in the package from the above URL?

Oh, also, there are some slight problems with the patch, like a patch for access control "sneaking in", extra whitespaces at the ends of lines, and tabs instead of whitespaces...

BTW this new SolrPhpClient needs PHP >=5.2.0 or the PECL JSON extension.

Are we then setting minimum requirements to be PHP >= 5.2.0?

JacobSingh’s picture

@janusman

Thanks for the comments.

1. The access control thing... That's weird because I thought I had already committed *that* particular change. I'll have to look it up in the morning, sorry about that. I'll re-roll it what I have some more sleep.

2. I'm using a new IDE, so I apologize if it's got tabs set, I'll look into that as well.

3. The patch is just to sync the SolrPHPClient with the latest version AND provide compatibility in the module (because some structures have changed). I don't know what to do about the requirements. The PhpSolrClient uses JSON by default. The old version was hacked by Robert to use XML... I prefer to not hack the library if we can at all help it... but then we don't want to create a barrier to entry. What do you guys think?

More than the class, please try out the test, and see if that is working for you.

Best,
Jacob

robertdouglass’s picture

In chat I encouraged Jacob to package his test with the patch. If we decide not to update to the latest Solr PHP client because of the 5.2 dependency (which I hadn't considered), we at least need to extract the test.

What is our current minimum PHP version requirement for this module? Does anyone know? How early of a PHP will break the code we currently ship?

robertdouglass’s picture

StatusFileSize
new2.29 KB

Looked briefly at the tests. What I learned:

We are writing tests for the DRUPAL-6--1-2 version of the simpletest module, not the DRUPAL-6--2-x branch.

I removed the use of dpr() (since it comes from devel module), fixed a couple whitespace errors, and zipped up the file. It makes evaluating the tests easier. Maybe we need a different issue for this?

robertdouglass’s picture

Status: Active » Needs work
JacobSingh’s picture

Well, the test is dependent on the new library code.

Have either of you applied it and ran the test?

janusman’s picture

Not yet tested, have to install a D6 instance or wait for the D5 patch.

My only point was about raising the minimum supported version of PHP. IMO I say we use the new SolrPhpClient as long as we don't also need to use Solr1.3 (not yet stable), and set the minimum PHP requirements to 5.2.0

From the WTF department-- my locally-compiled PHP 5.1.6 has json_encode/decode support... and I don't seem to have compiled that in :)

robertdouglass’s picture

@janusman: tsk tsk... please do the necessary to be able to review D6 patches!

JacobSingh’s picture

I don't know where to go forward here, but I think we should get this committed really soon because other patches are subject to get screwed up if we are changing our primary interface. Plus, all of our commits should be run against a simpletest...

What do you guys think? Should I commit this, or is more work needed from Robert's patch?

janusman’s picture

StatusFileSize
new153.43 KB

Problems...

I tried to apply this to the DRUPAL-6 version (patch -p0 < new_solr_php_library_and_index_test.diff inside the apachesolr/ dir) and I got these errors:

patching file SolrPhpClient/Apache/Solr/Service.php
Hunk #1 FAILED at 1.
Hunk #3 FAILED at 61.
2 out of 3 hunks FAILED -- saving rejects to file SolrPhpClient/Apache/Solr/Service.php.rej

The rest seems to have patched correctly. After manually patching the rest of Service.php, the interface seems to work fine (only found the link to "run cron" is bad after deleting the index, but that's not the patch's fault).

With the simpletest-6.x-1.2 module installed, these problems come up (starting from a clean Solr index):

6 passes, 5 fails and 2 exceptions.
Solr/search results: Assure that searches with apachesolr yield correct results.
'Equal expectation fails because [Integer: 1] differs from [Integer: 0] by 1' Searched for node #1 at [/opt/lampp/htdocs/dev/6/sites/all/modules/apachesolr/tests/solr_search_results.test line 101]	FAIL
'Equal expectation fails because [Integer: 1] differs from [Integer: 0] by 1' Searched for node #2 at [/opt/lampp/htdocs/dev/6/sites/all/modules/apachesolr/tests/solr_search_results.test line 103]	FAIL
'Equal expectation fails because [Integer: 2] differs from [Integer: 0] by 2' Searched for nodes #1 and #2 at [/opt/lampp/htdocs/dev/6/sites/all/modules/apachesolr/tests/solr_search_results.test line 106]	FAIL
Searched for node #1 through type search at [/opt/lampp/htdocs/dev/6/sites/all/modules/apachesolr/tests/solr_search_results.test line 122]	FAIL
Searched for node #1 through uid search at [/opt/lampp/htdocs/dev/6/sites/all/modules/apachesolr/tests/solr_search_results.test line 140]	FAIL
Unexpected PHP error [Invalid argument supplied for foreach()] severity [E_WARNING] in [/opt/lampp/htdocs/dev/6/sites/all/modules/apachesolr/tests/solr_search_results.test line 112]	EXCEPTION
Unexpected PHP error [Invalid argument supplied for foreach()] severity [E_WARNING] in [/opt/lampp/htdocs/dev/6/sites/all/modules/apachesolr/tests/solr_search_results.test line 130]	EXCEPTION

After replacing a test with robert's from #6, the same failures and exceptions come up.

janusman’s picture

Woops! It seems I already had some nodes in my install (tsk, you only mentioned the INDEX would get clobbered!)

Will test again from zero nodes.

janusman’s picture

StatusFileSize
new429.55 KB

Hm. Weird. I reinstalled a D6 instance, have no content in it, restarted Solr, installed the apachesolr, simpletest and other modules, and I am now getting different problems:

1) Can't run the Solr/search results test; the page never actually finished loading (and Solr is not doing anything).
2) Other tests run, but Solr/query breadcrumb and Solr/query handling return failures.

See attached image.

JacobSingh’s picture

Yeah, looks like the patch has gone stale. I'll try to re-roll it tonight.

Regarding the tests, I don't really know about the other tests, this one is just for the index/query test. It seems to be working okay, although you are getting different results for some of those... are you using a different version of solr?

Best,
J

janusman’s picture

Im running Solr 1.2.0... copied the schema.xml from the yesterday's DRUPAL-6--1 branch...

mikejoconnor’s picture

Status: Needs work » Needs review
StatusFileSize
new328.84 KB

Here is a patch against the 5.x version.

This patch will update the SolrPhpClient that ships with apachesolr-5.x-1.x-dev, to the SolrPhpClient.2008-09-02.zip found here https://issues.apache.org/jira/browse/SOLR-341

I have tested this against my 5.x install of the apacheSolr Module using Solr 1.3.0

Note: this patch does not include tests, it only updates the SolrPhpClient.

mikejoconnor’s picture

StatusFileSize
new331.83 KB

The previous patch missed the apachesolr.module and apachesolr_search.module files.

robertdouglass’s picture

Hmm. I run into this problem while applying the patch:

File to patch: SolrPhpClient/phpdocs/todolist.html 
patching file SolrPhpClient/phpdocs/todolist.html
patching file apachesolr.module
patch: **** malformed patch at line 8300: @@ -561,10 +564,10 @@ function apachesolr_block($op = 'list', 
mikejoconnor’s picture

StatusFileSize
new3.54 KB

Here is a patch for just the apachesolr.module and apachesolr_search.module from 5.x-1.x

Hope that helps.

robertdouglass’s picture

Assigned: JacobSingh » Unassigned
StatusFileSize
new7.51 KB

That patch was incomplete. Use this one to upgrade to D6.

mikejoconnor’s picture

Assigned: Unassigned » mikejoconnor

Assigning to myself

robertdouglass’s picture

Assigned: mikejoconnor » Unassigned
Status: Needs review » Fixed

Done for both branches. Please open another issue with the simple tests - we need those to not get lost or forgotten.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.