|
@@ -248,7 +248,10 @@ class SearchController extends Controller
|
248
|
248
|
{
|
249
|
249
|
if (strlen($word) > 1)
|
250
|
250
|
{
|
251
|
|
- if (strlen(str_replace(strtoupper($canonicalizer->canonicalize($word)), '', strtoupper($tag['slug']))) < 4)
|
|
251
|
+ if (
|
|
252
|
+ strlen(str_replace(strtoupper($canonicalizer->canonicalize($word)), '', strtoupper($tag['slug']))) < 4
|
|
253
|
+ && $word != $search
|
|
254
|
+ )
|
252
|
255
|
{
|
253
|
256
|
$tag_sorted = $this->sort_addtop_if_isnt_in($tag_sorted, $tag);
|
254
|
257
|
}
|
|
@@ -263,12 +266,21 @@ class SearchController extends Controller
|
263
|
266
|
explode(' ', $search),
|
264
|
267
|
explode('-', $search)
|
265
|
268
|
);
|
|
269
|
+
|
266
|
270
|
$tags_counteds = array();
|
267
|
271
|
foreach ($tags as $i => $tag)
|
268
|
272
|
{
|
|
273
|
+ $terms_search = array_merge(
|
|
274
|
+ explode(' ', $tag['slug']),
|
|
275
|
+ explode('-', $tag['slug'])
|
|
276
|
+ );
|
|
277
|
+
|
269
|
278
|
foreach ($terms as $word)
|
270
|
279
|
{
|
271
|
|
- if (strpos(strtoupper($tag['slug']), strtoupper($word)) !== false)
|
|
280
|
+ if (
|
|
281
|
+ strpos(strtoupper($tag['slug']), strtoupper($word)) !== false
|
|
282
|
+ && count($terms_search) > 2
|
|
283
|
+ )
|
272
|
284
|
{
|
273
|
285
|
$count = 1;
|
274
|
286
|
if (array_key_exists($tag['id'], $tags_counteds))
|
|
@@ -300,13 +312,17 @@ class SearchController extends Controller
|
300
|
312
|
explode(' ', $tag['slug']),
|
301
|
313
|
explode('-', $tag['slug'])
|
302
|
314
|
);
|
303
|
|
-
|
304
|
|
- if ($words_search == $words_tag)
|
|
315
|
+
|
|
316
|
+ if (count($words_search) == count($words_tag))
|
305
|
317
|
{
|
306
|
318
|
$same_found = true;
|
307
|
319
|
}
|
308
|
320
|
|
|
321
|
+ // Cette verif permet de ne pas ajouter les tags qui n'ont qu'un mot
|
|
322
|
+ // Si on ajouté ce tag maintenant il ne serais pas ajouté au controle en dessous
|
|
323
|
+ // (nom identique) et donc pas au dessus.
|
309
|
324
|
$tag_sorted = $this->sort_addtop_if_isnt_in($tag_sorted, $counted['tag']);
|
|
325
|
+
|
310
|
326
|
}
|
311
|
327
|
}
|
312
|
328
|
|
|
@@ -330,11 +346,14 @@ class SearchController extends Controller
|
330
|
346
|
// Ci-dessous on déduit si le mot étant identique au tag représente bien
|
331
|
347
|
// le terme de recherche. De façon a si c'est le cas pouvoir dire:
|
332
|
348
|
// oui le terme recherché est connu.
|
333
|
|
- (in_array($word, array(
|
|
349
|
+ if (in_array($word, array(
|
334
|
350
|
$search,
|
335
|
351
|
str_replace(' ', '-', $search),
|
336
|
352
|
str_replace('-', ' ', $search)
|
337
|
|
- ))) ? $same_found = true :
|
|
353
|
+ )))
|
|
354
|
+ {
|
|
355
|
+ $same_found = true;
|
|
356
|
+ }
|
338
|
357
|
$tag_sorted = $this->sort_addtop_if_isnt_in($tag_sorted, $tag);
|
339
|
358
|
}
|
340
|
359
|
}
|