|
@@ -243,9 +243,14 @@ class SearchController extends Controller
|
243
|
243
|
foreach ($tags as $i => $tag)
|
244
|
244
|
{
|
245
|
245
|
// Pas plus de trois caractères en plus de la recherche
|
246
|
|
- $terms = array_merge(array($search), explode(' ', $search));
|
|
246
|
+ $terms = array_merge(
|
|
247
|
+ explode(' ', $search),
|
|
248
|
+ explode('-', $search),
|
|
249
|
+ explode(',', $search)
|
|
250
|
+ );
|
247
|
251
|
foreach ($terms as $word)
|
248
|
252
|
{
|
|
253
|
+ $word = trim($word);
|
249
|
254
|
if (strlen($word) > 1)
|
250
|
255
|
{
|
251
|
256
|
if (
|
|
@@ -264,7 +269,8 @@ class SearchController extends Controller
|
264
|
269
|
// on cherche les mot composé comme lui
|
265
|
270
|
$terms = array_merge(
|
266
|
271
|
explode(' ', $search),
|
267
|
|
- explode('-', $search)
|
|
272
|
+ explode('-', $search),
|
|
273
|
+ explode(',', $search)
|
268
|
274
|
);
|
269
|
275
|
|
270
|
276
|
$tags_counteds = array();
|
|
@@ -272,14 +278,16 @@ class SearchController extends Controller
|
272
|
278
|
{
|
273
|
279
|
$terms_search = array_merge(
|
274
|
280
|
explode(' ', $tag['slug']),
|
275
|
|
- explode('-', $tag['slug'])
|
|
281
|
+ explode('-', $tag['slug']),
|
|
282
|
+ explode(',', $tag['slug'])
|
276
|
283
|
);
|
277
|
284
|
|
278
|
285
|
foreach ($terms as $word)
|
279
|
286
|
{
|
|
287
|
+ $word = trim($word);
|
280
|
288
|
if (
|
281
|
289
|
strpos(strtoupper($tag['slug']), strtoupper($word)) !== false
|
282
|
|
- && count($terms_search) > 2
|
|
290
|
+ && count($terms_search) > 3
|
283
|
291
|
)
|
284
|
292
|
{
|
285
|
293
|
$count = 1;
|
|
@@ -295,6 +303,7 @@ class SearchController extends Controller
|
295
|
303
|
}
|
296
|
304
|
}
|
297
|
305
|
|
|
306
|
+
|
298
|
307
|
foreach ($tags_counteds as $id => $counted)
|
299
|
308
|
{
|
300
|
309
|
if ($counted['count'] > 1)
|
|
@@ -305,14 +314,17 @@ class SearchController extends Controller
|
305
|
314
|
|
306
|
315
|
$words_search = array_merge(
|
307
|
316
|
explode(' ', $search),
|
308
|
|
- explode('-', $search)
|
|
317
|
+ explode('-', $search),
|
|
318
|
+ explode(',', $search)
|
309
|
319
|
);
|
|
320
|
+ $words_search = array_unique($words_search);
|
310
|
321
|
|
311
|
322
|
$words_tag = array_merge(
|
312
|
323
|
explode(' ', $counted['tag']['slug']),
|
313
|
324
|
explode('-', $counted['tag']['slug'])
|
314
|
325
|
);
|
315
|
|
-
|
|
326
|
+ $words_tag = array_unique($words_tag);
|
|
327
|
+
|
316
|
328
|
if (count($words_search) == count($words_tag))
|
317
|
329
|
{
|
318
|
330
|
$same_found = true;
|
|
@@ -333,23 +345,29 @@ class SearchController extends Controller
|
333
|
345
|
array($search),
|
334
|
346
|
explode(' ', $search),
|
335
|
347
|
explode('-', $search),
|
|
348
|
+ explode(',', $search),
|
336
|
349
|
array(str_replace(' ', '-', $search)),
|
337
|
350
|
array(str_replace('-', ' ', $search))
|
338
|
351
|
);
|
339
|
352
|
|
340
|
353
|
foreach ($terms as $word)
|
341
|
354
|
{
|
|
355
|
+ $word = trim($word);
|
342
|
356
|
if (strlen($word) > 1)
|
343
|
357
|
{
|
344
|
358
|
if (strtoupper($canonicalizer->canonicalize($word)) == strtoupper($tag['slug']))
|
345
|
359
|
{
|
346
|
|
- // Ci-dessous on déduit si le mot étant identique au tag représente bien
|
347
|
|
- // le terme de recherche. De façon a si c'est le cas pouvoir dire:
|
|
360
|
+ // Ci-dessous on déduit si le mot est identique au tag .
|
|
361
|
+ // De façon a ce que si c'est le cas, pouvoir dire:
|
348
|
362
|
// oui le terme recherché est connu.
|
349
|
363
|
if (in_array($word, array(
|
350
|
364
|
$search,
|
351
|
365
|
str_replace(' ', '-', $search),
|
352
|
|
- str_replace('-', ' ', $search)
|
|
366
|
+ str_replace('-', ' ', $search),
|
|
367
|
+ str_replace(',', ' ', $search),
|
|
368
|
+ str_replace(', ', '-', $search),
|
|
369
|
+ str_replace(',', ' ', $search),
|
|
370
|
+ str_replace(', ', '-', $search)
|
353
|
371
|
)))
|
354
|
372
|
{
|
355
|
373
|
$same_found = true;
|