Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Number of search results

edited May 2006 in Vanilla 1.0 Help
When I search for something in a Vanilla forum, I get the results, which is nice, and I get to click on a "next" link to go to the next page of results, but I can't see anywhere how many results there are, or how many pages of results.

I think it would be quite nice, it's a bit of a difference between having two pages and twenty pages of results. If I get too many results I tend to try to restrict my search, or try other words, so I would really like it if you could see how many results were found.

Or am I just missing something obvious?

Comments

  • This was brought up a long long time ago when vanilla was still in its infancy and not well known. Mark can correct me on the accuracy of this quote (yeah, I am too lazy to make a search since it was over a year ago), but it went along the lines of : "it would hurt". Translation: doing all the searching and joins on the DB and pulling up a total at once would really slow the query down. If you were to do just a search for "a" on a database of this size or larger and crank out the page count with 10 results on each page and you'll likely slow down everything else on the forum considerably. This way vanilla is taking the least ammount of time to do a search by doing it in segments 1-30 30-60 etc without hitting on performance too much.
  • Why wouldn't it simply limit the search terms to a certain amount of characters minimum?
  • Well, you'd still have the slowdown problem with large databases, even if you set a minimum amount of characters. What about MySQLs count() function? My SQL is rusty, but couldn't you select <stuff>, count(*) from <tables> where <search terms> limit 0, 30 Edited somehow of course, because you're selecting both a big list and a summary thing there, but it might be possible somehow? I do know that count returns the full number, ignoring the 'limit' statement.
  • I suppose it depends how count calculated the total. I'd assumed it was limited to the limit but if you say it's not then it must have some other way of working it out. Some timing and calculations would need to be done fo sho.
  • MarkMark Vanilla Staff
    edited May 2006
    Have you ever noticed on google it says "Results 1 - 100 of about 432,000,000"

    It doesn't give the exact number of results because it is inefficient to do so. It has an engine that guesstimates the number of results, and even if there are only 3 or 4 pages of results, it's still an estimate, and sometimes it is wrong (Have you ever clicked to see the last page of google results and had it bump you back to the page you were on with the last page link removed?).

    Vanilla doesn't have any fancy search indexing or guesstimation engine. The only way to get the number of search results is to run the same query that gets the results for that page, minus the limit statement, and with count() function. It means that you put the database through over twice the work because it would have to: Search, Get all results, Group them and return the count, Search, Get all results, limit to that page worth of results.

    The tables are indexed nicely, but it's still a very slow process to query against a text field with likes and a bunch of and/or statements.

    So, in the name of speed, I got rid of search result count. It made the searches twice as fast when I did that.
This discussion has been closed.