I have been testing this module with taxonomies and have found that for a free text taxonomy it works but only because array_filter function always returns null, when you use a multiple select taxonomy the $request_options[$terms_key] will be an array of tids anyway, but when it runs through the array_filter function it returns null so it always goes into the if statement never the else which is where you want it to go when you have an array of tids in $request_options[$terms_key]

Current Code in sphinxsearch_common.inc (line 301)

$tids = array_filter(array_map('intval', array_map('trim', explode(',', $request_options[$terms_key]))));
if ($request_options[$terms_key] != implode(',', $tids)) {
    // Request came with a comma separated list of terms.
   $terms = sphinxsearch_taxonomy_decode_typed_terms($vid, $request_options[$terms_key]);
}
else {
   // Request came with a comma separated list of tids.
   $terms = sphinxsearch_taxonomy_get_terms($vid, $tids);
}

My change code in sphinxsearch_common.inc (line 301) that seems to work, which be right or wrong, I do not understand the full implications of this change at this point to the rest of the search.

//$tids = array_filter(array_map('intval', array_map('trim', explode(',', $request_options[$terms_key]))));
if (is_string($request_options[$terms_key])) {
    // Request came with a comma separated list of terms.
    $terms = sphinxsearch_taxonomy_decode_typed_terms($vid, $request_options[$terms_key]);
}
else {
    // Request came with a comma separated list of tids.
    $terms = sphinxsearch_taxonomy_get_terms($vid, $request_options[$terms_key]);
}

I'm pretty new to drupal and php so apologies if I haven't explain it properly.

Comments

markus_petrux’s picture

Status: Active » Needs review

hmm... could you please try this?

Replace this line:

$tids = array_filter(array_map('intval', array_map('trim', explode(',', $request_options[$terms_key]))));

With this:

if (is_array($request_options[$terms_key])) {
  $tids = array_values($request_options[$terms_key]);
}
else {
  $tids = array_filter(array_map('intval', array_map('trim', explode(',', $request_options[$terms_key]))));
}
sped2773’s picture

Status: Needs review » Needs work

Still blows on (line 308 with changes above) because code below always fails.

if ($request_options[$terms_key] != implode(',', $tids))

which in turn passes an array to sphinxsearch_taxonomy_decode_typed_terms function

warning: preg_match_all() expects parameter 2 to be string, array given in Z:\environment\www\sites\all\modules\sphinxsearch\sphinxsearch.taxonomy.inc on line 68.

markus_petrux’s picture

Status: Needs work » Closed (duplicate)

I'll be marking all issues related to D6 port of this module as dup of this one:

http://drupal.org/node/306959

I hope to get things fixed by this weekend.

markus_petrux’s picture

Status: Closed (duplicate) » Fixed

This should be fixed in new development snapshot that will be generated next midnight.

markus_petrux’s picture

Status: Fixed » Closed (fixed)