Same Search results returned on sebsequent searches
Brought to you by:
jberanek
When a search is conducted the first search returns correct results but subsequent searches returns the same results as the first search even when a different search term is used. It seems our browser or server is caching the ajax page which is returning the results. Is there a way around this?
Just to check, which search do you mean? If you mean the search panel just above the table on the search results page (search.php), then this doesn't perform a new search, it searches within the search results.
As for caching of the search results, MRBS tries very hard to make sure nothing caches the page:
Last edit: John Beranek 2017-02-15
I've just done a quick test and can't reproduce this (if you meant caching of the search results). I did a search in one browser, created a new event in another and then repeated the search in the first browser. The new event showed up as expected.
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "DO NOT USE - Support Requests"
Hi John and Campbell,
Thank you for the quick response.
I am refering to the search box at the top of the page. The advance search is also only showing the results from the first search conducted. For example, if I search for the word 'test' I get a result. If I then click back and search for 'search' the results for 'test' are shown but the text at the top left of the page updates correctly with 'Search Results for: "search"'.
As I do this test now, the results being shown are from 11 hours ago.
I will message you the webiste address and login details so you have have a look see.
Thanks
Thanks for the login details. Yes, I can now reproduce the problem on your system. Strange! I'll have a think about it.
I can see that the search string sent in the Ajax request is still the old search string. I'll see if I can figure out why.
OK - I think I see what the problem is, and I'm working on a fix (and trying to figure out why I'm not able to reproduce it on my system).
I think the problem is to do with the use HTTP_REFERER in js/search.js.php, but I haven't yet figured out why it works on my system and not yours.
Could you try this version of js/search.js.php and see if it makes any difference?
I can see from Chrome developer tools that when I'm using your server the search.js.php file is coming from disk cache, while when I'm using my server it's being downloaded afresh from the network. I'm not quite sure why that is and both servers are using HTTP 1.1, but what I've done in the file above is changed the cache control headers to see if it makes any difference. You'll obviously need to flush the browser cache first. (As the file contains the search string this would explain what's happening. It's probably not a very good idea to have the search string in the file anyway, so in the longer term I'll think about a different way of doing things.)
I can also see that the Cache Expiry date in the Response Headers on your system looks like this
whereas I would expect
Have you modified functions.inc at all? In particular rfc1123_date() or expires_header()?
Hi Campbell,
I have made some changes to functions.inc but I did not change either of those functions.
I'll do a compare with a fresh install and see what I've done.
Your new search.js.php has fixed the problem.
I use Firefox and Firebug and can see the odd Cache Expirey date in the .js.php responses but the normal .php responses don't display that issue. Also, the expiry date of the normal php responses is one week from today. As I am the only one who has experienced this issue, it looks like this is something I have done. Please done spend anymore time on this. I'll look into is more closely and get back to you soon with my findings.
Thanks for your assistance.
Hi Campbell,
I don't know if this is any help but the version of 1.5.0 my server is based on was downloaded from HG web on 30 Sep 2016. The downloaded file was called mrbs-hg-code-12cda8ce787e89d9003e4c4e29b3281eb1f15d69.zip
I've checked my changes against the downloaded files and I haven't changed anything which may have affecetd the headers or the date format.
I will download ver 1.6.0 and make my edits against that version. If the Expired dates are changed after my edit I will know it was me.
Thanks.
BTW The two functions you asked about are:
Yes, those two functions look fine. I'm keen to get to the bottom of this in case there's something about your webserver set up that is exposing a bug in MRBS.
Let us know if a vanilla install of MRBS 1.6.0 works properly. If it doesn't then there's a problem we need to investigate.
Did you ever try a vanilla install of 1.6.0? It looks like someone else is seeing a similar problem with Report in Bug 379.
See also my comments and questions about mod_expires in Bug 379.