Class WFDieselSearchHelper

Description

High-level class to help manage complex faceted navigation searches.

Typically a UI has more complicated "query management" needs than a plain-old search, particularly for faceted navigation. This class helps facilitate these needs.

The WFDieselSearchHelper object acts as a broker between the UI/Application Logic and the raw DP search backend.

Needs:

  • Ability to combine a general "free-form query" with faceted navigation. [simpleQuery]
  • Ability to automatically produce a faceted navigation UI and maintain state while offering rich UI for browsing. [attributeQueries]
  • Ability to restrict the search further, but not show these restrictions in the UI. [restrictDQL]
This class is the "model" that tracks all of the complex query capabilities and works together with the faceted nav UI widgets to display them.

Located in /framework/WFDieselpoint.php (line 879)

WFObject
   |
   --WFDieselSearchHelper
Class Constant Summary
Variable Summary
Method Summary
void addAttributeQuery (string $attribute, string $comparator, mixed $query)
WFDieselSearchHelper __construct ()
void buildQuery ()
void clearAttributeQueries (string $attribute)
string getAttributeSelection (string $attribute, [object WFFormatter $formatter = NULL])
string getQueryState ([string $excludeAttribute = NULL], [array $newAttributeQueries = array()])
boolean isFilteringOnAttribute (string $attribute)
boolean isShowAll ()
string queryDescription ()
void resetQueryState ()
string restrictDQL ()
void setAttributeQueryMode (string $attribute, string $mode)
void setDieselSearch (object WFDieselSearch $dieselSearch)
void setQueryState (string $state)
void setRestrictDQL (string $string)
void setSimpleQuery (string $string, [string $mode = "any"])
string showAllDPQL ()
string simpleQuery ()
string simpleQueryMode ()
Variables
array $attributeQueries (line 911)
  • var: An array of all facet queries. Each entry contains the attribute, comparator, and value. ie: EQ_property_type=Single Family
  • access: protected
array $attributeQueryLogicalOperators (line 915)
  • var: An array of the logical operator to use for multiple attributeQueries on the same attribute. Format: 'attributeID' => 'any'|'all'. Default for each attribute is "any".
  • access: protected
object WFDieselSearch $dieselSearch (line 890)
  • var: The search instance to operate on
  • access: protected
string $restrictDQL (line 899)
  • var: A DQL query to add to the query. The WFDieselNav will not reveal to the user any info in the restrictDQL query, so it's perfect for constraining searches in a way that is transparent to the user.
  • access: protected
string $showAllDPQL (line 924)
  • var: If showAllOnBlankQuery is true, this is the DQL that will be used to "find all items".
  • access: protected
boolean $showAllOnBlankQuery (line 920)
  • var: Should the search "Show All" if there is no query?
  • access: protected
string $simpleQueryMode (line 907)
  • var: The "mode" of the simpleQuery. One of "all", "any", "exact".
  • access: protected
string $simpleQueryString (line 903)
  • var: The user-entered "free-form query".
  • access: protected
array $widgets (line 894)
  • var: An array of WFWidget subclasses that implement the dieselSearchRestoreState method
  • access: protected
Methods
addAttributeQuery (line 1141)

Add a query for a given attribute.

  • see: WFDieselSearchHelper::$legalComparatorList
  • throws: object WFException If the comparator is invalid.
void addAttributeQuery (string $attribute, string $comparator, mixed $query)
  • string $attribute: The attribute ID.
  • string $comparator: The comparator.
  • mixed $query: The value to match.
Constructor __construct (line 944)
WFDieselSearchHelper __construct ()

Redefinition of:
WFObject::__construct()
buildQuery (line 997)

Convert the query represented by this instance into DQL and set it up with the associated WFDieselSearch.

void buildQuery ()
clearAttributeQueries (line 1162)

Clear all queries for the passed attribute ID.

void clearAttributeQueries (string $attribute)
  • string $attribute: The attribute ID.
clearSimpleQuery (line 1420)

Clear the simpleQuery part of the search.

void clearSimpleQuery ()
dieselSearch (line 989)

Get the WFDieselSearch used by this instance.

object WFDieselSearch dieselSearch ()
getAttributeSelection (line 1189)

Get a human-readable description of the current attribute selections for the passed attribute.

string getAttributeSelection (string $attribute, [object WFFormatter $formatter = NULL])
  • string $attribute: The attribute ID.
  • object WFFormatter $formatter: A formatter object that will be used to "format" the value(s).
getQueryState (line 1310)

Get the queryState for the current instance.

The result is plain-text; it will need to be urlencode() as necessary.

string getQueryState ([string $excludeAttribute = NULL], [array $newAttributeQueries = array()])
  • string $excludeAttribute: The attribute ID of an attribute to REMOVE from the current state (or NULL to preserve all). Useful for creating "remove" filter links.
  • array $newAttributeQueries: An array of new "attribute queries" to add to the current state. Useful for creating links to possible sub-queries. The "attribute query" format is <op>_<attribute_id>=<query>
getQueryStateWithoutSimpleQuery (line 1279)

Get the queryState for the current instance, WITHOUT the simpleQuery filter.

The result is plain-text; it will need to be urlencode() as necessary.

string getQueryStateWithoutSimpleQuery ()
getQueryStateWithRestrictDQLOnly (line 1291)

Get the queryState for the current instace with ONLY the restrictDQL filter.

This is useful for a "clear all filters" link.

string getQueryStateWithRestrictDQLOnly ()
isFilteringOnAttribute (line 1252)

Is there any filter on the passed attribute?

boolean isFilteringOnAttribute (string $attribute)
  • string $attribute: The attribute ID.
isShowAll (line 1103)

Based on the executed query, are we doing a "show all"?

boolean isShowAll ()
queryDescription (line 1471)

Get a pretty "description" of the current query.

  • return: The description.
  • todo: Right now this just wraps queryDescription. Eventually re-write here to use a "pretty" description built a la buildQuery.
string queryDescription ()
registerWidget (line 967)

WFWidget subclasses that can interact with WFDieselSearch should register.

Objects must implement the WFDieselSearchHelperStateTracking interface.

void registerWidget (object WFWidget $widget)
resetQueryState (line 1350)

Reset the query state to "empty".

Note that this does not clear the restrictDQL.

void resetQueryState ()
restrictDQL (line 1412)

Get the "restrictDQL" query.

  • return: A DQL query.
string restrictDQL ()
setAttributeQueryMode (line 1126)

Set the "any/all" mode for EQ queries where there is more than one value for the attribute.

  • throws: object WFException If the passed mode is invalid.
void setAttributeQueryMode (string $attribute, string $mode)
setDieselSearch (line 978)

Set the WFDieselSearch instance to use with this WFDieselSearchHelper instance.

  • throws: object WFException If the parameter is not a WFDieselSearch.
void setDieselSearch (object WFDieselSearch $dieselSearch)
setQueryState (line 1367)

Set the query state to the passed state.

NOTE: if you are using WFDieselSearch with a paginator, and you get errors about "relevance" not being a sort option when restoring state with setQueryState, make sure that you call setQueryState BEFORE you call readPaginatorStateFromParams, as setQueryState will add the "relevance" sort option if the query state includes a simpleQuery.

void setQueryState (string $state)
  • string $state: The serialized state. Should be in plain-text form (ie all decoding already done)
setRestrictDQL (line 1402)

Set the DQL query to be used to restrict the search results in ways IN ADDITION TO what the user selects in the UI.

void setRestrictDQL (string $string)
  • string $string: A DQL query.
setSimpleQuery (line 1434)

Set the simpleQuery part of the search.

Note that if using a paginator, a "Relevance" sort option (-relevance) will be automatically added to the possible sort options.

  • throws: object WFException if the mode is incorrect.
void setSimpleQuery (string $string, [string $mode = "any"])
  • string $string: The query. This is typically the direct user input into a "basic search" field.
  • string $mode: The mode for the simplequery: one of "any", "all", or "exact".
showAllDPQL (line 1114)

Ge the DQL that is used to "show all".

string showAllDPQL ()
simpleQuery (line 1450)

Get the simpleQuery string.

string simpleQuery ()
simpleQueryMode (line 1460)

Get the simpleQuery mode.

  • return: One of "any", "all", "exact".
string simpleQueryMode ()

Inherited Methods

Inherited From WFObject

WFObject::__construct()
WFObject::exposedProperties()
WFObject::getClass()
WFObject::keyPathToTargetAndKey()
WFObject::setValueForKey()
WFObject::setValueForKeyPath()
WFObject::setValuesForKeys()
WFObject::validatedSetValueForKey()
WFObject::validatedSetValueForKeyPath()
WFObject::validateObject()
WFObject::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForStaticKey()
WFObject::valueForStaticKeyPath()
WFObject::valueForTargetAndKeyPath()
WFObject::valueForUndefinedKey()
WFObject::valueForUndefinedStaticKey()
WFObject::valuesForKeyPaths()
WFObject::valuesForKeys()
WFObject::_valueForStaticKey()
WFObject::__toString()
Class Constants
ATTRIBUTE_QUERY_ALL = "all" (line 885)
ATTRIBUTE_QUERY_ANY = "any" (line 884)
QUERY_STATE_RESTRICT_DQL_QUERY_ATTR_NAME = 'dpqlQuery' (line 882)
QUERY_STATE_SIMPLE_QUERY_ATTR_NAME = 'simpleQuery' (line 881)

Documentation generated on Thu, 14 May 2009 16:19:56 -0400 by phpDocumentor 1.4.2