Pawtucket2:Advanced Search

From CollectiveAccess Documentation
Revision as of 19:35, 22 July 2014 by Seth (talk | contribs) (Views)
Jump to: navigation, search

Pawtucket's advanced search system provides a framework for creating custom field-level search forms without programming. All that is needed is some basic configuration and a search form view laying out the required fields. The forms can search any field that is indexed and support the following features:

  1. Boolean combination of search terms, including AND, OR and NOT
  2. Repeatable fields
  3. Full text search
  4. Single "field list" elements that may search any of a list of fields
  5. Customizable element width, height and default values
  6. Session-based last-search memory

Configuration

All advanced search forms must have an entry in the advancedSearchTypes section of your theme's app.conf file. A typical configuration for a pair of type-specific object advanced search forms might look like this:

advancedSearchTypes = {
	artworks = {
		displayName = _(Art),
		table = ca_objects,
		restrictToTypes = [artwork],
		view = Search/ca_objects_advanced_search_artworks_html.php,
		itemsPerPage = 10,
		
		sortBy = {
			Relevance = _natural,
			Identifier = ca_objects.idno,
			Name = ca_object_labels.name
		}
	},
	library = {
		displayName = _(Library),
		table = ca_objects,
		restrictToTypes = [book],
		view = Search/ca_objects_advanced_search_library_html.php,
		itemsPerPage = 10,
		
		sortBy = {
			Relevance = _natural,
			Identifier = ca_objects.idno,
			Name = ca_object_labels.name
		}
	}
}

Views

To include a field in a form simply add the field's bundle specifier surrounded by {{{ and }}} characters. Ex. {{{ca_objects.idno}}} will add a search element for object identifiers.

Accessing your forms

The url for each defined form is in the format /Search/advanced/[form_code]. A full URL to the artworks form would be http://mysite.com/index.php/Search/advanced/artworks

Namespaces

Variants
Actions
Navigation
Tools
User
Personal tools