Google custom search API - sorting / filter

2019-02-26 15:42发布

问题:

Is there anyway to filter the results by page title tag or certain meta tags... I read the documentation... but it's a mess :-( Is anybody have an idea??

回答1:

Yes, you can sort and filter on custom meta tags.

First, put the data you want to filter on into meta tags: <meta name="color" value="blue">

Next, test that Google can find the tags by testing your URL with the Rich Snippet Tool Under the 'Structured data for filtering search results', you should see more:pagemap:metatags-color:blue.

Finally, query your custom search engine with the structured data string above. Putting more:pagemap:metatags-color:blue in the search box works, or use it with your query parameter (usually q) in the URL.

For numeric meta tags, you can sort with sort=more:pagemap:metatags-sales_rank (or whatever your attribute is).

To search on page title it should work to use Google's standard intitle: operator.