Controller/WikiTagController.php
changeset 34 21fab44f46fe
parent 30 d2fba1e3b94b
child 35 92ddb5488eb4
equal deleted inserted replaced
30:d2fba1e3b94b 34:21fab44f46fe
   168             
   168             
   169             // We get the DocumentTag and change its tag
   169             // We get the DocumentTag and change its tag
   170             $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneBy(array('document' => $id_doc, 'tag' => $id_moved_tag));
   170             $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneBy(array('document' => $id_doc, 'tag' => $id_moved_tag));
   171             $dt->setTag($tag);
   171             $dt->setTag($tag);
   172             $dt->setWikipediaRevisionId($revision_id);
   172             $dt->setWikipediaRevisionId($revision_id);
   173             //
   173             
   174             // TODO: HERE QUERY TO GET A INDEX_NOTE/SCORE for the tag. Here is python code :
   174             $score_res = $this->container->get('wiki_tag.search')->search($tag_label, array("id"=>$id_doc));
   175             //kwargs = {DJANGO_ID + "__exact": unicode(ds_id)}
   175             
   176             //results = SearchQuerySet().filter(title=tag_label).filter_or(description=tag_label).filter(**kwargs)
   176             if(count($score_res)>0)
   177             //if len(results) > 0:
   177             {
   178             //    ts.index_note = results[0].score
   178                 $score = floatval($score_res[0]['score']);
   179             //
   179             }
       
   180             else
       
   181             {
       
   182                 $score = 0.0;
       
   183             }
       
   184             $dt->setIndexNote($score);
       
   185             
   180             // We set ManualOrder = true for the current document
   186             // We set ManualOrder = true for the current document
   181             $doc = $this->getDoctrine()->getRepository('WikiTagBundle:Document')->findOneBy(array('externalId' => $id_doc));
   187             $doc = $this->getDoctrine()->getRepository('WikiTagBundle:Document')->findOneBy(array('externalId' => $id_doc));
   182             $doc->setManualOrder(true);
   188             $doc->setManualOrder(true);
   183             // We save the datas
   189             // We save the datas
   184             $em->flush();
   190             $em->flush();