Pawtucket2:Advanced Search

From CollectiveAccess Documentation
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 search.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
		}
	}
}

Note: The above configuration creates two separate advanced search pages (one for the Library search and one for the Artwork search).

Views

After the advancedSearchTypes have been configured in the theme's search.conf file, metadata and other page details can be set in /views/search. Look for the file corresponding to the configured table, i.e. ca_objects_advanced_search_objects_html.php (for objects).

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

Troubleshooting

Common issues:

Problem: A drop-down menu in your advanced search form isn't displaying any values.

Solution: Make sure the Access settings for the list items are set to public.

sphinx

Namespaces

Variants
Actions
Navigation
Tools
User
Personal tools