Search fails until refresh for some users

This forum is for all Flare related Tips and Tricks.
Have a tip or trick you use while working in Flare? Share it here.
Post Reply
ghillerson
Propeller Head
Posts: 85
Joined: Wed Mar 05, 2014 10:22 pm
Location: Near Santa Cruz, CA
Contact:

Search fails until refresh for some users

Post by ghillerson »

I'm using Top-Nav and Flare 12. Various employees and customers of our software are reporting that when they search for something they know is in the docs (i.e. in the Flare search input field), they get a search results page showing nothing found. Doing a browser page refresh (F5) always fixes the problem. For example, go to doc.splicemachine.com and search for import_data; no results. Press F5 and try again, and you get a page of results. Which indicates that it must be a cache issue.

I do not see this issue on my PCs, but our software runs only on Macs and other Unix variants, and the vast majority of our users are working with Chrome. So my guess is that this is specific to Chrome on the Mac. But no matter why it's happening, I need to find a solution, and I can't tell customers to switch to a different browser.

A similar issue was solved on a specific page in our Community Site (WordPress) - the company managing that WordPress site added something to tell browsers to not cache the page, and the problem went away. Is there something I can do in the search skin to take care of this problem, or a target setting that will work?

Any suggestions appreciated ...

Gary
devans
Sr. Propeller Head
Posts: 108
Joined: Thu Sep 09, 2010 9:56 pm
Location: Sydney Australia

Re: Search fails until refresh for some users

Post by devans »

I have just come across the exact same issue with a user. When I searched for a term, I got multiple hits. When he searched, nothing. I was thinking that the difference might be that I am constantly deleting cookies on my machine because otherwise there are times when new topics are not displayed in my TOC.

I am using Chrome on a PC and I think my user might be using Firefox.

I'm not certain if there's a way to force delete cookies on a website?
ghillerson
Propeller Head
Posts: 85
Joined: Wed Mar 05, 2014 10:22 pm
Location: Near Santa Cruz, CA
Contact:

Re: Search fails until refresh for some users

Post by ghillerson »

I'm fairly certain this is a cache issue, and in my case, I'm certain that it's specific to Chrome on the Mac. I don't think cookies enter the picture, but I'm not an expert.
devans
Sr. Propeller Head
Posts: 108
Joined: Thu Sep 09, 2010 9:56 pm
Location: Sydney Australia

Re: Search fails until refresh for some users

Post by devans »

You're probably right about the cache. I clear the cache and delete cookies at the same time so it's probably the cache causing the problem. But it definitely happens on PCs too. If I move the file for a topic and then click on that topic in the TOC, I get an error 404 File not found. If I clear the cache, it finds the file.

Just had a quick look online to see if there is a way to force Chrome to clear the cache when starting up but I can't find anything.
ghillerson
Propeller Head
Posts: 85
Joined: Wed Mar 05, 2014 10:22 pm
Location: Near Santa Cruz, CA
Contact:

Re: Search fails until refresh for some users

Post by ghillerson »

I believe there's some javascript (jquery) that could be added, though I'm not sure where. I don't know if it's the search results page that needs to be refreshed (in which case jquery/javascript) could be added to that page that would force a refresh, or if the problem lies elsewhere.
ghillerson
Propeller Head
Posts: 85
Joined: Wed Mar 05, 2014 10:22 pm
Location: Near Santa Cruz, CA
Contact:

Re: Search fails until refresh for some users

Post by ghillerson »

My current thinking is that I can so something like this with jquery, but I don't know how to do it:

When the search bar form field gets the focus, call a function that:
1) refreshes the window (window.location.reload()) ?
2) focus on the search bar again (without triggering the reload)

Can anyone comment on this help with the jquery function / event-trigger ?
ghillerson
Propeller Head
Posts: 85
Joined: Wed Mar 05, 2014 10:22 pm
Location: Near Santa Cruz, CA
Contact:

Re: Search fails until refresh for some users

Post by ghillerson »

I tried getting help from MadCap support, but they weren't able to reproduce the problem and thus couldn't solve it.

At this point, I have decided to disallow caching of the search results page. This page gets generated when you build a target, so I have to modify it post-build. I do this by running a sed script on our unix server after uploading the built output. The sed script (named addNoCache.sed) looks like this:

Code: Select all

s/<head>/<head>\n\t<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" \/>\n\t<meta http-equiv="Pragma" content="no-cache" \/>\n\t<meta http-equiv="Expires" content="1" \/>\n/
And I run it like this:

Code: Select all

sed -i.bak -f addNoCache.sed Search.html
Post Reply