Advertisement:

Author Topic: Total Search Results  (Read 3483 times)

learner

  • Jr. Member
  • **
  • Posts: 50
Total Search Results
« on: November 02, 2013, 11:42:26 pm »
Hi OSclass Community
Can you pleas tell me how can I increase total search results, at the moment it shows only 1200 results and osc_search_total_items() also return 1200 max even if there are more than 1200 in that category. I did query analysis it is limited to 1200 but dont know where this value is set.
Further more what will be impact on performance if I want to show count equal to all the items (e.g. 100K) in result count.
Thanks

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Total Search Results
« Reply #1 on: November 03, 2013, 01:06:15 am »
Hi,

I guess you have "12" set as value for "Search page shows X listings at most" in your Dashboard / Settings / General. If you put there 100, 100,000 results might be returned (if so many are found).

It's likely each page would need at least twice the time to be displayed on pages with no search pattern, and probably so so so much more with a pattern.  :-\ This regarding the technical part, the other matter is that people rarely browse more than a bunch of pages (with 10, 20 results per page, maybe just one page with 100 results would be enough for many...) ???

Regards


learner

  • Jr. Member
  • **
  • Posts: 50
Re: Total Search Results
« Reply #2 on: November 03, 2013, 01:52:30 am »
Thanks teseo,
I ve 12 results per page and dont want to change this, so you means by default it just search for 100 pages. I actually want to show how many ads in database for selected categary/search.
I agree people would not search more than 5-10 pages but people also like big figures, so if all searches shows there are only 1200 results or 100 pages they will not be satisfied with website, so I just want to show total results.
Guys your help will be much appreciated.
Thanks

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Total Search Results
« Reply #3 on: November 03, 2013, 04:13:40 pm »
You see, this has proven quite interesting for me... I'll explain myself:

What you want wouldn't be too expensive in terms of time waiting for results if we were talking just about generic searches in regions or cities (i.e "show me all ads in Boston"), just one additional query to count all results.

The real issue resides in searches with pattern (keywords). With a big database you search for a very common term like "job" and every related query including that pattern (three per page of results) takes a big while. Adding yet another query to count all the occurences in the database wouldn't be an option.

But, what if we could make only that expensive additional search query, store its results (a lot of ads id's) for the rest of the normal queries use them with no need to repeat fulltext pattern searching thrice for every page produced by the search? ???

A lot to change in the core code, but I think at first glance the idea seems very attractive. If someone knowledgeable enough reads this and find some flaw, please let me know. I'm going to work on this because I happen to be working right now with a database such as like that and this issue of searches taking so long I would like to find a solution within Osclass itself. ???

Regards
« Last Edit: November 03, 2013, 04:20:04 pm by teseo »

ruslanruslan

  • Newbie
  • *
  • Posts: 37
Re: Total Search Results
« Reply #4 on: June 12, 2014, 12:27:50 am »
did anyone slove this problem?

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Total Search Results
« Reply #5 on: June 13, 2014, 08:17:47 pm »
Hi,

Yes, in fact nothing more than a little modification in a core file is required.

oc-includes/osclass/model/Search.php

Locate this block (line 979 in Osclass 3.3.2):

Code: [Select]
                // order & limit
                $this->dao->orderBy( $this->order_column, $this->order_direction);

                if($count) {
                    $this->dao->limit(100*$this->results_per_page);
                } else {
                    $this->dao->limit( $this->limit_init, $this->results_per_page);
                }

Just comment // $this->dao->limit(100*$this->results_per_page);

Take into account that this might slow down things a bit when working with a big database, mostly the pattern searchs. To avoid that happening you'd need to do a bigger modification.

And, remember that this is a core file, you'll need to redo this modification every time you upgrade Osclass.

Regards

_carlison

  • Full Member
  • ***
  • Posts: 134
Re: Total Search Results
« Reply #6 on: October 15, 2017, 04:33:34 pm »
Hi,

Yes, in fact nothing more than a little modification in a core file is required.

oc-includes/osclass/model/Search.php

Locate this block (line 979 in Osclass 3.3.2):

Code: [Select]
                // order & limit
                $this->dao->orderBy( $this->order_column, $this->order_direction);

                if($count) {
                    $this->dao->limit(100*$this->results_per_page);
                } else {
                    $this->dao->limit( $this->limit_init, $this->results_per_page);
                }

Just comment // $this->dao->limit(100*$this->results_per_page);

Take into account that this might slow down things a bit when working with a big database, mostly the pattern searchs. To avoid that happening you'd need to do a bigger modification.

And, remember that this is a core file, you'll need to redo this modification every time you upgrade Osclass.

Regards

Hi Tesso,

Thanks for this information.

Can u tell me what i need to do bigger modification to avoid slow down site. ? coz if my website has approx 1,00,000 listing then what modification i need to do?