Question

I'm using Google Site Search (https://www.google.com/cse) on a site as the internal search engine. In Google Site Search it's possible to set up categories so that the users on the site can filter the search result by categories. I have specified three categories in the settings. Category1, Category2 and Category3.

I'm marking up pages like the following in the header:

<!--
                <PageMap>
                  <DataObject type="document">
        <Attribute name="pagetype">Category2</Attribute>
        </DataObject>
                </PageMap>
              -->

On my result page I get the three categories as tabs. So far so good. But when I click any of the three tabs, I just get "No results" on the page.

I have found out that if I add the following to the query stringin the URL the search engine will find pages marked up with the category specified: +more:p:document-pagetype:Category2 This means that my entire URL will look something like this: http://domain.com/search?q=searchterms+more:p:document-pagetype:Category2

But if I do this, the tab called "Category2" is not marked as the active tab, and the "+more:p:document-pagetype:Category2" are going into Google Analytics as a part og the search-string.

So can anyone help me out with this, so I can make it work?

If you need any other information to help me out please let me know as well.

Was it helpful?

Solution

You can use refinements for this: https://support.google.com/customsearch/answer/2631064?hl=en

When you set up a refinement (a label), you get to fill 2 fields: name and optional words. If you use +more:p:document-pagetype:Category2 as optional word, this string will get attached to user's query automatically whenever they click that tab.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top