Not a big issue, but $snippet is undefined in the first iteration of the loop in apachesolr_search_process_response(), which throws a NOTICE error.

Comments

cpliakas’s picture

Status: Active » Needs review
StatusFileSize
new779 bytes

The attached patch initializes the variable, which fixes the issue.

kaare’s picture

Priority: Minor » Major
StatusFileSize
new705 bytes

The reason it's undefined is because the test using it is just wrong. It's testing whether the previous result document is empty, which (usually) it never is, as theme('apachesolr_search_snippet') at least returns ' ...'. A more correct test is the one attached. I assume the test in line 552 is whether we have an available snippet yet for this document.

This has become a major issue for me right now as a lot of my content types return empty snippets when using faceted search and no terms are given.

This patch works for me, btw. My snippets are back ;-)

dawansv’s picture

Yes I have the same problem with no snippets showing except for the first item in the list when doing a facet search without keyword. That's because the test on $snippet carries the snippet from the previous doc, and so it never gets set for the next documents!

Patch in #2 solves the problem. Thanks.

It's surprising there is not more "chatter" around this issue as this render non-keyword searches inoperative.

pwolanin’s picture

why === 0 instead of e.g. empty(), or even just implicit cast to boolean?

kaare’s picture

No good reason. if (! $snippets) is better, I agree.

soyarma’s picture

StatusFileSize
new693 bytes

so with that in mind, is the attached patch to everyone's liking?

jpmckinney’s picture

Status: Needs review » Closed (duplicate)