Add CRE support to votingapi tags

pcambra - April 11, 2008 - 08:46
Project:Content Recommendation Engine
Version:5.x-1.0
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi

I am trying to make a custom block using votingapi tags to separate the "normal" votes from the "special" votes i need, but from the query i see that CRE does, this tags are not filtered:

I've reached to this query (approx):

SELECT d.content_id2 as 'content_id',sum(d.sum+d.count*r.value)/sum(d.count) as 'score',n.title
    FROM cre_similarity_matrix d,votingapi_vote r,node n
    WHERE d.content_type1='product'
    AND r.content_type = d.content_type1
    AND n.type = d.content_type1
    AND d.content_id1<>r.content_id
    AND d.content_id2=r.content_id
    AND n.nid=d.content_id1
    AND r.tag = 'customer_related'   <--- here is the custom tag filter
    AND n.nid<> %d
    AND d.content_id2 = %d
    GROUP BY d.content_id1 ORDER BY score DESC

But if there are nodes voted in more than one tag, wrong results are returned, as there is no tag column in cre_similarity_matrix, so the values returned are from all tags and not from the tag selected.

I think that adding a tag field on cre_similarity_matrix and populating it on cre_modify_avg_difference() function from cre.module file will be enough, am i missing something?

I will implement the changes on my local site and test them.

#1

pcambra - April 17, 2008 - 13:22

Hi, there is no answer for now, so i post the changes i've made to cre module to include tag support.

here is the alter table to get tags working
ALTER TABLE cre_similarity_matrix ADD tag VARCHAR(128);

And I attach de diff file of the changes made.

AttachmentSize
cre_diff.patch 1.72 KB
 
 

Drupal is a registered trademark of Dries Buytaert.