--- a/Controller/WikiTagController.php Sun Nov 06 23:45:50 2011 +0100
+++ b/Controller/WikiTagController.php Mon Nov 07 17:25:39 2011 +0100
@@ -134,7 +134,7 @@
/**
* Modify the tag in the context of a tag list for one document
- *
+ *
*/
public function modifyDocumentTagAction()
{
@@ -190,13 +190,13 @@
/**
*
- * @Route("/wtrtd")
* TODO : Enter description here ...
* TODO : implement
*/
public function reorderTagDocumentAction()
{
$id_Doc = $this->getRequest()->request->get('wikitag_document_id');
+ $res = $this->getDoctrine()->getRepository('WikiTagBundle:Document')->search(null,'test', null);
return $this->renderDocTags($id_doc);
}
@@ -482,7 +482,7 @@
/**
*
* Resemantize the tag with its original label. Kind of undo if we changed the tag's label.
- *
+ *
*/
public function resetWpInfoAction()
{
--- a/Entity/DocumentRepository.php Sun Nov 06 23:45:50 2011 +0100
+++ b/Entity/DocumentRepository.php Mon Nov 07 17:25:39 2011 +0100
@@ -4,7 +4,7 @@
use Doctrine\ORM\EntityRepository;
use IRI\Bundle\WikiTagBundle\Entity\Document;
-
+use Doctrine\ORM\Query\ResultSetMapping;
use \ReflectionClass;
/**
@@ -206,5 +206,42 @@
$document->setTagsStr(implode(",",$tagstr));
$this->getEntityManager()->persist($document);
}
+
+ /**
+ *
+ * Enter description here ...
+ * @param array $values : key: the fields to search into, value array('value'=>value, 'weight'=>weight)
+ * @param unknown_type $conditions
+ */
+ function search(array $values, array $conditions=NULL)
+ {
+/* $em = $this->getEntityManager();
+
+ $rsm = new ResultSetMapping();
+ $rsm->addEntityResult("IRI/Bundle/WikiTagBundle/Entity/Document", "d");
+ $rsm->addFieldResult("d", "id", "id");
+ $rsm->addFieldResult("d", "external_id", "externalId");
+ $rsm->addScalarResult("d", "score");
+
+ $score = "";
+ foreach ($values as $fielddef) {
+
+ $columns = $fielddef["columns"];
+ $value = $fielddef["value"];
+ $value = isset($fielddef["weight"])?$fielddef["weight"]:1.0;
+
+ $score = "(MATCH($columns) AGAINST (:value))*:weight";
+ $parameters[] =
+ }
+
+
+ $query = $em->createNativeQuery("SELECT d.id, d.external_id, MATCH(title) AGAINST('$value') FROM wikitag_document d WHERE MATCH(title) AGAINST('$value') > 0", $rsm);
+
+ $res = $query->getScalarResult();
+
+ return $res;*/
+
+
+ }
}
\ No newline at end of file
--- a/Listener/DocumentListener.php Sun Nov 06 23:45:50 2011 +0100
+++ b/Listener/DocumentListener.php Mon Nov 07 17:25:39 2011 +0100
@@ -115,9 +115,13 @@
}
elseif (is_a($entity, "IRI\Bundle\WikiTagBundle\Model\TagInterface"))
{
- foreach($entity->getDocuments() as $doctag)
+ $documents = $entity->getDocuments();
+ if(!is_null($documents))
{
- $this->getContainer()->get('doctrine')->getRepository("WikiTagBundle:Document")->updateTagsStr($doctag->getDocument());
+ foreach($documents as $doctag)
+ {
+ $this->getContainer()->get('doctrine')->getRepository("WikiTagBundle:Document")->updateTagsStr($doctag->getDocument());
+ }
}
}