204 $tagstr = $this->getTagsStr($document); |
204 $tagstr = $this->getTagsStr($document); |
205 |
205 |
206 $document->setTagsStr(implode(",",$tagstr)); |
206 $document->setTagsStr(implode(",",$tagstr)); |
207 $this->getEntityManager()->persist($document); |
207 $this->getEntityManager()->persist($document); |
208 } |
208 } |
|
209 |
|
210 /** |
|
211 * |
|
212 * Enter description here ... |
|
213 * @param array $values : key: the fields to search into, value array('value'=>value, 'weight'=>weight) |
|
214 * @param unknown_type $conditions |
|
215 */ |
|
216 function search(array $values, array $conditions=NULL) |
|
217 { |
|
218 /* $em = $this->getEntityManager(); |
|
219 |
|
220 $rsm = new ResultSetMapping(); |
|
221 $rsm->addEntityResult("IRI/Bundle/WikiTagBundle/Entity/Document", "d"); |
|
222 $rsm->addFieldResult("d", "id", "id"); |
|
223 $rsm->addFieldResult("d", "external_id", "externalId"); |
|
224 $rsm->addScalarResult("d", "score"); |
|
225 |
|
226 $score = ""; |
|
227 foreach ($values as $fielddef) { |
|
228 |
|
229 $columns = $fielddef["columns"]; |
|
230 $value = $fielddef["value"]; |
|
231 $value = isset($fielddef["weight"])?$fielddef["weight"]:1.0; |
|
232 |
|
233 $score = "(MATCH($columns) AGAINST (:value))*:weight"; |
|
234 $parameters[] = |
|
235 } |
|
236 |
|
237 |
|
238 $query = $em->createNativeQuery("SELECT d.id, d.external_id, MATCH(title) AGAINST('$value') FROM wikitag_document d WHERE MATCH(title) AGAINST('$value') > 0", $rsm); |
|
239 |
|
240 $res = $query->getScalarResult(); |
|
241 |
|
242 return $res;*/ |
|
243 |
|
244 |
|
245 } |
209 |
246 |
210 } |
247 } |