Search code examples
seogoogle-custom-search

Searching multiple labels in google CSE


I know it has been asked before: 1, 2. But I was reading the documents and saw it might be possible.

I need to add multiple refinements to the query in google custom search engine. So if I have multiple labels on my CSE, I would like to query a subset of them in a way. Say I have three labels: news, articles and stories. I would like to be able to search for a query like earth in all the pages included in news or stories.

For adding just one label, querying like this works fine: earth more:news. But no like when I add the second label.

According to google's documentation, you can use OR between multiple refinements. But It does not work for me. I'm using javascript and the RESTful APIs and yet I tried many combinations:

  • earth more:news more:stories
  • earth more:news OR more:stories
  • earth [more:news OR more:stories]
  • earth more:news,stories

Anyone has any ideas how it would work?


Solution

  • It seems AND and OR options are only for pagemap data and meta-tags and they don't work on directory structures and labels.