Remove specific items from the search results at query time

Background

This article shows how to remove specific items from the search results at query time.

Process

Curator

Create a curator rule with a remove specific results action.

Use the scope parameter

The scope CGI parameter can be used to apply an include/exclude to the result set.

Examples

# Remove http://mysite.com/sample/file.html
http://funnelbackserver/s/search.html?collection=mycollection&query=keyword&scope=-mysite.com/sample/file.html
# Remove https://myothersite.com/sample/file2.html
http://funnelbackserver/s/search.html?collection=mycollection&query=keyword&scope=-mysite.com/sample/file.html,-https://myothersite.com/sample/file2.html

Use a specific metadata key

If the results have a unique identifier stored in metadata then this can be used to remove the item from the search results.

There are two ways that the item can be removed:

  • Add a metadata not CGI parameter containing the ID (&meta_ID_not=VALUE)

  • Add query terms specified using the Funnelback query language (&query=-ID:VALUE)

Examples

# meta_ID_not CGI parameter
# Remove a single value from the ID metadata field
http://funnelbackserver/s/search.html?collection=mycollection&query=keyword&meta_ID_not=VALUE
# Remove multiple values from the ID metadata field
http://funnelbackserver/s/search.html?collection=mycollection&query=keyword&meta_ID_not=VALUE1&meta_ID_not=VALUE2
# Remove multiple values from the ID1 and ID2 metadata fields
http://funnelbackserver/s/search.html?collection=mycollection&query=keyword&meta_ID1_not=VALUE1&meta_ID2_not=VALUE2

# query language inside query parameter
# Remove a single value from the ID metadata field
http://funnelbackserver/s/search.html?collection=mycollection&query=keyword%20-ID:VALUE
# Remove multiple values from the ID metadata field
http://funnelbackserver/s/search.html?collection=mycollection&query=keyword%20-ID:VALUE1%20-ID:VALUE2
# Remove multiple values from the ID1 and ID2 metadata fields
http://funnelbackserver/s/search.html?collection=mycollection&query=keyword%20-ID1:VALUE1%20-ID2:VALUE2

Use the indexed URI metadata fields

The process for removing using the indexed URL is the same as for specific metadata above. The URL is stored in two special metadata classes:

  • u: contains the hostname component of the URL

  • v: contains the path component of the URL

Thus a URL could be removed with queries similar to:

Examples

// Remove http://mysite.com/sample/file.html
http://funnelbackserver/s/search.html?collection=mycollection&query=keyword&meta_v_not=sample/file.html