Closed (fixed)
Project:
Taxonomy NCO
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Sep 2011 at 13:30 UTC
Updated:
14 Nov 2011 at 11:20 UTC
Line 94 ... 102 of taxonomy_nco.module
$sql = "SELECT tid_b, nco FROM {taxonomy_nco}
WHERE tid_a IN (:tid_list)
AND (a_and_b >= :minimum_match_intersection)
AND (nco >= :minimum_match_nco)
ORDER BY nco DESC";
$placeholders = array(':tid_list' => $tid_list,
':minimum_match_intersection' => $minimum_match_intersection,
':minimum_match_nco' => $minimum_match_nco);
$result = db_query($sql, $placeholders);
foreach($result as $record) {
$output[$record->tid_b] = $record->nco;
}
The above works fine for single tids. However, if tid_list contains multiple tids (comma separated), the above appears to ignore all but the first tid.
Comments
Comment #1
aparimana commentedAlso: another bug in the same code:
With multiple tids, the query is likely to pull back multiple nco ratings for each tid_b. The code above with end up passing back the nco value of the last-listed-instance of each tid_b, which is essentially random. A more useful behaviour would be to pass back the maximum nco for each tid_b.
Comment #2
aparimana commentedI have fixed both of these by rewriting the query using the abstraction objects:
Note that the query does not bother ordering the results by nco values, as the php code lower down (line 184) manually sorts the results after merging in forced nco values
The code above is contained in the patch submitted here: http://drupal.org/node/1266546 - I have therefore not created a patch for just these changes
Comment #3
russellb commentedThanks again AP, good to have the multiple tids going in D7.
Committed:
http://drupal.org/commitlog/commit/12120/e632054bd812ac754e6944a1ccff46a...
Comment #4
russellb commented