Search on a subset of topics automatically

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets

Search on a subset of topics automatically

Postby whunter on Wed Mar 27, 2019 10:01 am

Here's what I want to do:
* Flag a subset of topics in my help file with a specific concept tag.
* Create a page in the help with a Search bar that automatically searches only the topics with that concept tag (using search filters).

I can flag the topics and create the page, but what I'm stumbling on is that I don't see any way to configure the Search Bar Proxy to use a specific search filter.
Is there a way to do this with the Flare functionality?
If not, is there a way to (semi-easily) do this using some scripting or something like that?

Thanks in advance for any assistance!
whunter
Sr. Propeller Head
 
Posts: 429
Joined: Thu Mar 12, 2009 4:49 pm
Location: Portland, OR

Re: Search on a subset of topics automatically

Postby Dave Lee on Thu Mar 28, 2019 1:16 am

You can't do this with Flare, so it would require a script.

Inserting this script on the search page would do the job:

Code: Select all
$(document).ready(function(){
   $(".menu").on("loaded", function () {
      $(".search-filter-content li:contains('Search filter text goes here')").click();
   });
});


In short, it waits for Flare's menus to finish loading, then clicks on the search filter menu item that contains some particular text. Replace 'Search filter text goes here' with some or all of the text as it appears in your search filter menu.
Dave Lee
Master Propellus Maximus
 
Posts: 5855
Joined: Mon Mar 05, 2007 8:33 am
Location: UK

Re: Search on a subset of topics automatically

Postby whunter on Thu Mar 28, 2019 9:20 am

Thanks Dave. That works, but there are two issues:

1. The presence of this script on the search page seems to interrupt other scripts that are in the master page (these scripts do things like create an in-page TOC and set a Home link in the breadcrumb). I could set up the search page to use a different master page, but just mentioning in case there's some easy workaround.

2. This is a SideNav project, so there is also a search bar in the top of the skin. While the script does set the search filter in the desired search bar within the topic, it also sets it in the top search bar and unfortunately leaves the filter drop-down open on that search bar. Which is a little confusing. I don't suppose there's any way to target the script just to the search bar in the topic?

Thanks again for any help.
whunter
Sr. Propeller Head
 
Posts: 429
Joined: Thu Mar 12, 2009 4:49 pm
Location: Portland, OR

Re: Search on a subset of topics automatically

Postby Dave Lee on Fri Mar 29, 2019 12:17 am

1. I can't see why this script would affect your others, but I don't know how you're running the other scripts.

2. If the search bar is inserted using a search bar proxy, then you could put the search bar proxy inside a div; e.g.
<div id="topic-search-bar"> <MadCap:searchBarProxy ... /></div>
So you can then use that div to target that particular search bar in the the script:
$("div#topic-search-bar .search-filter-content li:contains('Search filter text goes here')").click();
Dave Lee
Master Propellus Maximus
 
Posts: 5855
Joined: Mon Mar 05, 2007 8:33 am
Location: UK

Re: Search on a subset of topics automatically

Postby whunter on Fri Mar 29, 2019 9:21 am

1. You're right -- it doesn't. I was confused for silly reasons.

2. This resolves the issue where the search filter drop-down is left open in the top search bar. It still sets the search filter for both search bars, but it looks like they just can't be set independently -- if you manually change one, the other changes to match. So I'll live with it!

Thank you so much for the help!
whunter
Sr. Propeller Head
 
Posts: 429
Joined: Thu Mar 12, 2009 4:49 pm
Location: Portland, OR


Return to Web-based Outputs

Who is online

Users browsing this forum: No registered users and 6 guests