Don't move fq params to q.alt if fq params include local params

jpmckinney - December 1, 2009 - 18:14
Project:Apache Solr Search Integration
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

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.

AttachmentSize
patch.patch933 bytes

#1

pwolanin - December 1, 2009 - 18:37
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?

#2

jpmckinney - December 2, 2009 - 21:35
Status:needs work» needs review

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.

AttachmentSize
648036.patch 1.53 KB

#3

jpmckinney - December 2, 2009 - 21:36
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.

#4

pwolanin - December 2, 2009 - 21:40

should probably check

if ($move_fq) {

before this line:

$params['q.alt'] = implode(' ', $move_fq);

#5

jpmckinney - December 2, 2009 - 23:26

Amended.

AttachmentSize
648036.patch 1.56 KB
 
 

Drupal is a registered trademark of Dries Buytaert.