In an apachesolr_modify_query hook, I set local params ex and tag for various purposes. Note that I'm not using these local params to do OR faceting, so the special case in the 6.x-2.x branch - if (!$has_or ...) { - is no use.

A more general solution would be preferred. Here's something that would fix the bug for my case and the 6.x-2.x $has_or case, in all versions of apachesolr.

CommentFileSizeAuthor
#5 648036.patch1.56 KBjpmckinney
#2 648036.patch1.53 KBjpmckinney
patch.patch933 bytesjpmckinney

Comments

pwolanin’s picture

Status: Needs review » Needs work

Looks like a bug indeed, but note from php.net re: strstr():

If you only want to determine if a particular needle occurs within haystack , use the faster and less memory intensive function strpos() instead.

Also, should we consider just moving one or more fqs if possible for the performance reasons even if we cannot move all?

In other words we should possibly test each fq, not the imploded list of them?

jpmckinney’s picture

Status: Needs work » Needs review
StatusFileSize
new1.53 KB

Re-rolled to test each fq.

It also omits filter queries starting with '-', as these don't seem to work in q.alt. I discovered this when doing a key-less search with a -language:fr filter using apachesolr 6.x-2.x.

jpmckinney’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

This last patch is against 6.x-2.x, but a patch that excludes the $has_or changes will work against 6.x-1.x.

pwolanin’s picture

should probably check

if ($move_fq) {

before this line:

$params['q.alt'] = implode(' ', $move_fq);
jpmckinney’s picture

StatusFileSize
new1.56 KB

Amended.

jpmckinney’s picture

Status: Needs review » Fixed

Fixed as part of #552152-12: OR facet counts are confusing. Only relevant to 6.x-2.x.

pwolanin’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev
Status: Fixed » Patch (to be ported)

the original bug is relevant to all branches

jpmckinney’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

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