Printing a FB search filter on another standard page


(Innes Zenati) #1

Matrix Version:6.47.0

Looking for some advice on how to print the category / search filter on a standard page (will be within an aside class) to allow the user to filter pages by category without having to navigate to the search page.

We are using a similar filter on our publication search page and I did copy over the html from the draft blog search but its not taking effect on the blog listing page.

Is there a way to do this so the blog filter or would this require another asset listing?

idea of FB filter listing we are using on another page - https://www.ros.gov.uk/about/publications


#2

How about nesting your ā€œsearch pageā€ asset into the standard page asset?


(Iain Simmons) #3

Hi @innesz,

Iā€™m not sure Iā€™m fully following, but you might be looking for the Form submission URL option (setting to the Current URL):

The Form submission URL field allows you to control where the search form is submitted. This feature is useful if you nest the search page in another page. By default, this is set to the pageā€™s URL, meaning that the search page will submit to its own URL. The list of results will not be nested in another page, and the user will be redirected to the search page itself. The URL, the lineage, and the menu will change to be the search page. If you set this option to the current URL, the form is submitted to the current page you are viewing (that is, the page in which the search page is nested). This feature means that the list of results will be shown on the original page.


(Innes Zenati) #4

Hi @paul11 & @isimmons, thanks for getting back to me.

Yes, I think this would help achieve this. I want to have the same sort of category / topic filter that gov.uk use on their blog - https://insidegovuk.blog.gov.uk/

Doing this surfaces the blogs and takes them to a new page so would it be a matter of using the form submission URL method??


(Innes Zenati) #5

Would I first need to create a new search page asset?? Our blog search is driven by a standard page with a REST resource nested within the paint layout associated with that page.


#6

Looks like https://insidegovuk.blog.gov.uk/ are using Funnelback as their search engine. They are pulling all their search results from https://www.gov.uk/search/all.json which has 600K+ records

I am not sure if you are using FB or not? You can do it without Funnelback too, but if the number of items you are searching on are too large then it will put excessive load on Matrix server.

Just casually looking at their search page I saw that they are passing codes to the search URL associated with each topic and sub-topic in the dropdown. https://www.gov.uk/search/all.json?keywords=childcare&level_one_taxon=c58fdadd-7743-46d6-9629-90bb3ccc4ef0&level_two_taxon=90e8a226-8d40-4c1f-91e4-36a712b34e57&order=relevance

You too can achieve this functionality using different ways. It depends on what exactly you are searching on? Is your data residing in a datasource such as CSV data source or JSON data source? or are you searching content in standard pages?


(Innes Zenati) #7

Yes we are using FB also.

The content we are searching is standard pages only. Roughly around 100 odd assets but that will grow over time.


#8

Then the whole thing gets much easier. FB provides a JSON endpoint, which you can call from your frontend to fetch results. Check out this page on how you can effectively query Funnelback.


(Innes Zenati) #9

Superbā€¦ thanks very much Paul. Top man


(Innes Zenati) #10

Is it just a case of inputting that JSON endpoint within a drop-down form action within the aside class where I want this hosted for it to work within the page? Or am I still better creating a search page and nesting this within the paint layout and then using the JSON endpoint?


(Iain Simmons) #11

You would only call the JSON endpoint from the frontend if you had some client side JS code to handle it and render the desired HTML output.

Otherwise, you could pass in parameters via the nested REST asset (by having a form submit to the same page URL) and then handle the result in the JS Processing section of the REST asset. The request URL might be something like:

https://search.example.com/s/search.json?collection=publications&%globals_server_query_string^replace:collection=publications&:&^empty:query=!nullquery%

Also, hereā€™s a good article about different methods for integrating a Funnelback search:
https://docs.squiz.net/funnelback/docs/latest/build/getting-started/integrating-search-with-your-website.html