--- a/Controller/WikiTagController.php Wed Nov 09 16:25:13 2011 +0100
+++ b/Controller/WikiTagController.php Thu Nov 17 11:29:26 2011 +0100
@@ -170,13 +170,19 @@
$dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneBy(array('document' => $id_doc, 'tag' => $id_moved_tag));
$dt->setTag($tag);
$dt->setWikipediaRevisionId($revision_id);
- //
- // TODO: HERE QUERY TO GET A INDEX_NOTE/SCORE for the tag. Here is python code :
- //kwargs = {DJANGO_ID + "__exact": unicode(ds_id)}
- //results = SearchQuerySet().filter(title=tag_label).filter_or(description=tag_label).filter(**kwargs)
- //if len(results) > 0:
- // ts.index_note = results[0].score
- //
+
+ $score_res = $this->container->get('wiki_tag.search')->search($tag_label, array("id"=>$id_doc));
+
+ if(count($score_res)>0)
+ {
+ $score = floatval($score_res[0]['score']);
+ }
+ else
+ {
+ $score = 0.0;
+ }
+ $dt->setIndexNote($score);
+
// We set ManualOrder = true for the current document
$doc = $this->getDoctrine()->getRepository('WikiTagBundle:Document')->findOneBy(array('externalId' => $id_doc));
$doc->setManualOrder(true);