YAFLogo

JP
  • JP
  • 100% (Exalted)
  • YAF Leader Topic Starter
13 years ago
Yesterday, my server owner upgraded the server which the forum is running on...

We now have 2 CPU:s with in total 8 Intel 2.6 GHz cores, 20 GB of RAM and 512 MB of disk cache... Works wonders, now site does not bog down while using the forum search feature... Just one of the cores working at 100% for a couple of secs, which doesn't affect other sites on the same server...

This means I can search the whole forum content (330 000+ messages & 21 000+ topics) without any timeouts from the SQL Server or other crazy things happening during a search...

It also means I have upped the "max results" from a conservative 500 to 25000 so also messages from the start of the forum (2001) can be retrieved in a search. SInce a search seems to pose the same load (ie all messages are searched) in either case, I finally have a stable usable "search" which can really search the whole forum with ease.

Now to my question:

Since the default in the Search is 5 results per page, you get a helluva lot of pages if you just enter a search term and press the button without modifying that dropdown box. Even with the max value 50, I can get 500 pages... This poses a huge load on the paging logic when trying to eg "go to last page" is pressed.... The average user just types a search term and hits the button, and has the default values of "5 results per page", "All forums" and "Posted by" is left blank.

Instead of the 5, 10, 25 50 selections, I would need something like 100, 50, 25, 200 with 100 as the default value...

How can I make this happen?


He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Old Chinese Proverb]
Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
13 years ago
You need to modfiy the search.ascx.cs

// Load result dropdown
            this.listResInPage.Items.Add(new ListItem(this.GetText("result25"), "25"));
            this.listResInPage.Items.Add(new ListItem(this.GetText("result50"), "50"));
            this.listResInPage.Items.Add(new ListItem(this.GetText("result100"), "100"));
            this.listResInPage.Items.Add(new ListItem(this.GetText("result200"), "200"));

and also change the language strings in the english.xml

By the way, the search is currently very inefficient for example if an search item is found in the topic title each post is listet in the results from the topic. The search needs some optimization in the future.

JP
  • JP
  • 100% (Exalted)
  • YAF Leader Topic Starter
13 years ago
Thanks! ๐Ÿ‘

Another thing to put on the "modify before compile list" along with the other things you have helped me with. ยจ

And the order in the dropdown is the same as the add order, right?

So I would have them as 100, 50, 25, 200 - or is that set in the XML file?

I wish more of this stuff was stored in the db for dynamic load instead of static code, so you could modify things without recompiling... ๐Ÿ˜‰


He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Old Chinese Proverb]
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
13 years ago
The order is based on in which order you add them, To make 100 as default Value change it to...

// Load result dropdown
            this.listResInPage.Items.Add(new ListItem(this.GetText("result25"), "25"));
            this.listResInPage.Items.Add(new ListItem(this.GetText("result50"), "50"));
            this.listResInPage.Items.Add(new ListItem(this.GetText("result100"), "100"));
            this.listResInPage.Items.Add(new ListItem(this.GetText("result200"), "200"));

this.listResInPage.SelectedValue = "100";