News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Search results limited to one page on 2.0b3

Started by bdwelle, March 31, 2008, 08:25:38 PM

Previous topic - Next topic

bdwelle

I'm using 2.0b3. Search results are set to the default of 30 per page, but when I run a search and (I know) there are more than 30 results, the pagination isn't working, and I just get the first page of 30 results, with no way to navigate to the additional results pages. I am using the "No Index" search method (for now).

Any ideas? thx

SleePy

Does pagination show?
Do you get any errors in the error log?
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

bdwelle

Thanks for your reply

Pagination shows only this:
Pages: [1] -- so, it's trying to show something, but only shows the first page... If I change the "Number of search results per page" setting, just that number are displayed, but no more.

I cleared out the error log and ran a few searches and nothing shows up, so no, no messages in the error log.

Quote from: SleePy on April 10, 2008, 01:06:34 PM
Does pagination show?
Do you get any errors in the error log?

bdwelle

I did some digging in Search.php and here's what I found:

At the place where it does to calculate the page numbers, $num_results is set to ZERO - it should be not zero
// Now that we know how many results to expect we can start calculating the page numbers.
        $context['page_index'] = constructPageIndex($scripturl . '?action=search2;params=' . $context['params'], $_REQUEST['start'], $num_results, $modSettings['search_results_per_page'], false);


Tracing back up, $num_results is set from $_SESSION['search_cache']['num_results'], which itself gets set to ZERO as the result of an else,



                                // Insert subject-only matches.
                                if ($_SESSION['search_cache']['num_results'] < $modSettings['search_max_results'] && $numSubjectResults !== 0)
                                {
                                // removed here...
                                }
                                else
                                      $_SESSION['search_cache']['num_results'] = 0;


In turn, this test fails because $numSubjectResults is ZERO, because this SQL query returns ZERO rows:

INSERT IGNORE INTO smf_tmp_log_search_topics (id_topic) SELECT t.id_topic FROM smf_topics AS t INNER JOIN smf_log_search_subjects AS subj1 ON (subj1.id_topic = t.id_topic) WHERE subj1.word LIKE '%doubleclick%' LIMIT 1200


And that, in turn, is because smf_log_search_subjects has no rows that match subj1.word LIKE '%doubleclick%'

There are a few rows in smf_log_search_subjects, but, looking at the code, I can't see where new rows are inserted into this table...

Two conclusions:
1) if I force $num_results > 0 right before the call to constructPageIndex(), pagination works fine
2) if I force $numSubjectResults > 0 before // Insert subject-only matches, pagination works fine too (and displays the correct number of results)

It seems to me that $numSubjectResults is not getting set properly, likely because smf_log_search_subjects isn't getting loaded, but I'm not sure about the exact reason.. I don't know the code well enough.

ideas?

thx

SleePy

Are you using a index?
What are your search settings?
Any mods installed?
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

bdwelle

> Are you using a index?
Nope. Should I?

> What are your search settings?
The search settings are

Enable Simple Search? Not checked
30 results per page
1200 max results
Time required between searches: 5 seconds

> Any mods installed?
I have hacked in the reply-by-email mod, and we also have an integrate_verify_user() user lookup function, but as far as I know, neither of those have touched the search code.

metallica48423

were you ever able to resolve this one? (sorry for letting it sit so long)

have you tried it with a search here to see if you get a similar problem?
is it possible that theres really only one page of results? (probably unlikely)

I would try using an index, as well.
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

stellainformatica

Hi, I have the same problem of bdwelle, I see only one page of results, not other pages.
I tested with a migrated version and also with a new installa of Smf 2.0 RC1

greyknight17

stellainformatica, did you try the suggestions above on creating an index if you don't have one already? It should definitely work out of the box, but then again, you won't be able to test it out if it's new since there is nothing much to search for ;)

If you still have problems, please open up a new topic instead since this is an old and inactive topic.

Topic will be locked since it's abandoned by original poster.

Advertisement: