equal
deleted
inserted
replaced
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 // HERE QUERY TO GET A INDEX_NOTE/SCORE for the tag. Here is python code : |
174 // TODO: HERE QUERY TO GET A INDEX_NOTE/SCORE for the tag. Here is python code : |
175 //kwargs = {DJANGO_ID + "__exact": unicode(ds_id)} |
175 //kwargs = {DJANGO_ID + "__exact": unicode(ds_id)} |
176 //results = SearchQuerySet().filter(title=tag_label).filter_or(description=tag_label).filter(**kwargs) |
176 //results = SearchQuerySet().filter(title=tag_label).filter_or(description=tag_label).filter(**kwargs) |
177 //if len(results) > 0: |
177 //if len(results) > 0: |
178 // ts.index_note = results[0].score |
178 // ts.index_note = results[0].score |
179 // |
179 // |
193 * TODO : Enter description here ... |
193 * TODO : Enter description here ... |
194 * TODO : implement |
194 * TODO : implement |
195 */ |
195 */ |
196 public function reorderTagDocumentAction() |
196 public function reorderTagDocumentAction() |
197 { |
197 { |
198 $id_Doc = $this->getRequest()->request->get('wikitag_document_id'); |
198 $id_doc = $this->getRequest()->request->get('wikitag_document_id'); |
199 $res = $this->getDoctrine()->getRepository('WikiTagBundle:Document')->search(null,'test', null); |
199 $res = $this->getDoctrine()->getRepository('WikiTagBundle:Document'); |
|
200 $doc = $res->findOneByExternalId($id_doc); |
|
201 $doc->setManualOrder(false); |
|
202 $this->getDoctrine()->getEntityManager()->persist($doc); |
|
203 |
|
204 $search_service = $this->get('wiki_tag.search'); |
|
205 |
|
206 $search_service->reorderTagsForDocument($doc); |
|
207 |
|
208 $this->getDoctrine()->getEntityManager()->flush(); |
|
209 |
200 return $this->renderDocTags($id_doc); |
210 return $this->renderDocTags($id_doc); |
201 } |
211 } |
202 |
212 |
203 /** |
213 /** |
204 * |
214 * |
245 $new_DT->setDocument($this->getDoctrine()->getRepository('WikiTagBundle:Document')->findOneByExternalId($id_doc)); |
255 $new_DT->setDocument($this->getDoctrine()->getRepository('WikiTagBundle:Document')->findOneByExternalId($id_doc)); |
246 $new_DT->setTag($tag); |
256 $new_DT->setTag($tag); |
247 $new_DT->setOriginalOrder($new_order); |
257 $new_DT->setOriginalOrder($new_order); |
248 $new_DT->setTagOrder($new_order); |
258 $new_DT->setTagOrder($new_order); |
249 $new_DT->setWikipediaRevisionId($revision_id); |
259 $new_DT->setWikipediaRevisionId($revision_id); |
|
260 //TODO ; calculate score |
250 $em->persist($new_DT); |
261 $em->persist($new_DT); |
251 $em->flush(); |
262 $em->flush(); |
252 } |
263 } |
253 |
264 |
254 return $this->renderDocTags($id_doc); |
265 return $this->renderDocTags($id_doc); |