Facets are a powerful method of searching collections through the Sitellite ControlPanel. Facets are rendered on the browse screen of a given collection, under the heading "Search Parameters". The power of facets lies primarily in their ability to be combined to perform compound searches, often without typing anything at all (ie. via the 'select' facet type).
The facets for a collection are defined in the collection definition file for that collection. The following is a sample facet taken from the WebPages collection (in inc/app/cms/conf/collections/sitellite_page.php):
[facet:title]
display = Text
type = text
fields = "id, title, nav_title, head_title, description, keywords, body"
As you can see, facets are defined as INI blocks whose name begins with the word "facet" followed by a colon (:) and the name of the field in the collection (ie. the database column name) that the facet is associated with.
Facets always contain a display and a type property, which tell the facet what text to display to the user, and which facet type to use. There are seven built-in facet types in Sitellite:
select
Display an HTML select box of options for the user.
Extra properties include:
- fuzzy - A yes or no value that determines whether to use fuzzy matching or literal matching. Fuzzy matching in this case is akin to the SQL LIKE operator.
- values - A PHP eval()-able statement that retrieves an array of values to fill the option list.
- value n - Provides the ability to specify individual values on separate lines, ie. value 1 = yes.
list
Similar to the select type, but instead displays a list of HTML links.
Extra properties include:
- values - A PHP eval()-able statement that retrieves an array of values to fill the option list.
- value n - Provides the ability to specify individual values on separate lines, ie. value 1 = yes.
text
Displays an HTML text input box for the user to enter a textual search.
Extra properties include:
- fields - A list of additional fields (must include the one mainly associated with the facet) to be searched for the user-specified text. As shown in the example above, this allows a single facet to search multiple fields.
sitesearch
Similar to the text type, but instead integrates with SiteSearch to perform the actual search.
folder
Displays a list of folders to choose from. Used primarily by the WebFiles collection.
Extra properties include:
- values - A PHP eval()-able statement that retrieves an array of values to fill the option list.
- value n - Provides the ability to specify individual values on separate lines, ie. value 1 = yes.
filetype
Displays a list of file types to choose from. Also used primarily by the WebFiles collection.
Extra properties include:
- values - A PHP eval()-able statement that retrieves an array of values to fill the option list.
- value n - Provides the ability to specify individual values on separate lines, ie. value 1 = yes.
range
Performs a search of values between the two selected, but presents itself as a select box.
Extra properties include:
- values - A PHP eval()-able statement that retrieves an array of values to fill the option list.
- value n - Provides the ability to specify individual values on separate lines, ie. value 1 = yes.
Note that values in the range type should be specified as strings separated by a hyphen surrounded by a space on each side (' - ').
Revision from August 1, 2007 1:15 PM by lux
Back in time (1 more) | Linked from: Collections, New Collection, Control Panel