--- a/Controller/WikiTagController.php Mon Nov 07 17:25:39 2011 +0100
+++ b/Controller/WikiTagController.php Wed Nov 09 16:25:13 2011 +0100
@@ -171,7 +171,7 @@
$dt->setTag($tag);
$dt->setWikipediaRevisionId($revision_id);
//
- // HERE QUERY TO GET A INDEX_NOTE/SCORE for the tag. Here is python code :
+ // 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:
@@ -195,8 +195,18 @@
*/
public function reorderTagDocumentAction()
{
- $id_Doc = $this->getRequest()->request->get('wikitag_document_id');
- $res = $this->getDoctrine()->getRepository('WikiTagBundle:Document')->search(null,'test', null);
+ $id_doc = $this->getRequest()->request->get('wikitag_document_id');
+ $res = $this->getDoctrine()->getRepository('WikiTagBundle:Document');
+ $doc = $res->findOneByExternalId($id_doc);
+ $doc->setManualOrder(false);
+ $this->getDoctrine()->getEntityManager()->persist($doc);
+
+ $search_service = $this->get('wiki_tag.search');
+
+ $search_service->reorderTagsForDocument($doc);
+
+ $this->getDoctrine()->getEntityManager()->flush();
+
return $this->renderDocTags($id_doc);
}
@@ -247,6 +257,7 @@
$new_DT->setOriginalOrder($new_order);
$new_DT->setTagOrder($new_order);
$new_DT->setWikipediaRevisionId($revision_id);
+ //TODO ; calculate score
$em->persist($new_DT);
$em->flush();
}