Zoran Stanic
Zoran Stanic

Reputation: 3

GSA how to exclude items with empty metadata from results

I would need to filter some items present in the GSA index when serving results. I would need to exclude all items that have an empty value (so no value) in a specific metafield (xTopic).

I have tried adding the &requiredfields=-xTopic: to the search url but this doesn't work (the search is working fine). Any ideas if it is possible at all and what the syntax would be?

Upvotes: 0

Views: 324

Answers (2)

Zoran Stanic
Zoran Stanic

Reputation: 3

Ok, in case anyone needs this in the future - I was able to find the solution. It is true you cannot exclude any items that don't have value in a certain metatag. But, you can include only items that do have any value. So I was able to accomplish filtering by adding .xTopic (note that colon is missing -that was the part that I missed initially).

Upvotes: 0

Sander Korf
Sander Korf

Reputation: 91

As far as I know, it's only possible to retrieve results with metadata-inclusions and not with exclusions. A few ideas:

  • You could include all metatags except the one you'd want to exclude. I assume this is not a workable solution...
  • ... therefore, if you have control of the metatags in the source, you could add an additional metatag to all documents you don't want to exclude and perform a search including only that metatag.

Furthermore at least I don't have any other creative ideas. You could at least file a feature request at Google, I also filed this one a few weeks ago. The more the better!

Upvotes: 0

Related Questions