Search scoping

Funnelback can use a document’s URL to filter the search results. The scope CGI parameter will restrict the results to the document URLs that match the parameter.

For example, the query:

http://FUNNELBACK-SERVER/s/search.html?query=romeo&collection=shakespeare&profile=playsearch&scope=macbeth

will query the shakespeare search package, using the playsearch results page. The scope will limit the results to those documents that includes the word macbeth anywhere in the URL.

Note that the scope is a sub-string match to the document’s URL.

Syntax

The scope is a comma-separated list of strings that are matched against the URLs of documents that match the query terms. You can negate the match by placing a minus-sign at the start of a string.

You can also make use of the lscope and xscope options in a similar manner. lscpope performs a left match for the scope while xscope is an exact match.

Caveats

  • Protocols should not be included in the scoped search. E.g. Use 'www.funnelback.com' and not 'http://www.funnelback.com'.

Forms

Scopes are commonly used in search templates to:

  • restrict the search to a specific web site (or sub-site); or

  • allow the user to dynamically choose the site.

If you wish to hard-code the scope, then create a hidden element to set the scope:

<input type="hidden" name="scope" value="cmis.csiro.au,-vic.cmis.csiro.au">

Otherwise, you could use a select list to set the scope:

<@s.Select name="scope"
  id="scope"
  options=["=All","macbeth=Macbeth","much_ado=Much Ado About Nothing","merchant=Merchant of Venice"] />

Note the first option All sets the scope to an empty string, which means all documents.

Examples

The scope restriction:

scope=company.com,-shop.company.com

will return documents whose URLs match company.com and exclude any that match shop.company.com