Author Topic: SEARCH not working every time (Version 4.2.8)  (Read 1142 times)

Offline Bix

  • Full Member
  • *****
  • Posts: 30
  • Karma: +0/-0
SEARCH not working every time (Version 4.2.8)
« on: February 05, 2017, 04:12:38 AM »
Hi guys!

When I look for something inside the news using Search, the results aren't always correct.

I mean... I know that selection is based on title and text of the story, so I'm sure about which words are there and which not. With some words or phrases it works, with other words or phrases, it doesn't... Why?

Offline goli

  • Full Member
  • *****
  • Posts: 38
  • Karma: +2/-0
Re: SEARCH not working every time (Version 4.2.8)
« Reply #1 on: February 06, 2017, 08:28:41 AM »
I think it depends on how many posts you have...

Offline Bix

  • Full Member
  • *****
  • Posts: 30
  • Karma: +0/-0
Re: SEARCH not working every time (Version 4.2.8)
« Reply #2 on: February 06, 2017, 09:14:33 AM »
Only 46, at the moment. But, as I said, sometimes it works, sometimes not.

Is it possible that it could depend from the number of results? I ask that because I noticed that if I look for some word that I used a lot in the articles, search returns no results at all...

But the code doesn't seem to have limits about that:

Code: [Select]
'SELECT SQL_CALC_FOUND_ROWS * FROM onewse WHERE MATCH (otexty,oamess) AGAINST ('.$conn->qstr($id).') and (omain = '.$conn->qstr('0').' or omain = '.$conn->qstr('2').') LIMIT %d,%d',SmartyPaginate::getCurrentIndex(),SmartyPaginate::getLimit());
Maybe there's something I don' see...?
« Last Edit: February 06, 2017, 09:21:18 AM by Bix »

Offline goli

  • Full Member
  • *****
  • Posts: 38
  • Karma: +2/-0
Re: SEARCH not working every time (Version 4.2.8)
« Reply #3 on: February 06, 2017, 10:58:50 AM »
Try replace:

Code: [Select]
AGAINST ('.$conn->qstr($id).')
with

Code: [Select]
AGAINST ('.$conn->qstr($id).' IN BOOLEAN MODE)
Limit results:

Code: [Select]
SmartyPaginate::setLimit(10);

Offline Bix

  • Full Member
  • *****
  • Posts: 30
  • Karma: +0/-0
Re: SEARCH not working every time (Version 4.2.8)
« Reply #4 on: February 06, 2017, 06:24:25 PM »
Yeah! "IN BOOLEAN MODE" was the good tip (and looking online to understand the reasons, I've learned the "50%" rule I didn't know before)... Thanks (again) goli!!!
:)


PS: SmartyPaginate::setLimit(10); doesn't limit results: it simply sets the number of results displayed per page. ;)