Class SearchTrail

Description

SearchTrail class is use to to keep track of filters applied on search results. Its a Wrapper class for criteria that maintains a 'trail' of filters added to the current search.

It is used on places where previous search needed to start new search or filters search criteria based on previous search results. All filters applied on single search safe in the object of this class.

Each criteria is added independent of others, allowing for history, tracking, and subsequently choosing to backup to a previous result, or modify a single criteria filter. This class object would traditionally be used in a client environment such as a website showing the "trail" of filters/criteria applied to achieve the current search results and therefore allow a user to choose to remove or revert criteria. Example (4 criteria added each individually):

  • DisplayCategory: Computer Systems
  • Keyword: ibm
  • Category: Notebook
  • Keyword: thinkpad
At each of the 3 above steps the user filtered the results further, and creating a "bread-crumb trail" for them with 4 items.

Once they've narrowed it down, they may choose they want to expand the results by removing the 3rd criteria item. The interface could allow them to do so, and the SearchTrail object told to remove criteria item #3.

The resultant criteria would then have:

  • DisplayCategory: Computer Systems
  • Keyword: ibm
  • Keyword: thinkpad
In this way, it allows history of what choices a user has made, and lets them see exactly why they are seeing the results they are, and change them accordingly.* Type of Criteria/Filters added in the SearchTrail: <li>Keyords</li> <li>Categories</li> <li>Manufacturers</li> <li>Absolute/Non Absolute Attributes</li> SearchTrail also manages the display list for the trail object. For complete usage of SearchTrail object

Located in /models/SearchTrail.php (line 62)


	
			
Variable Summary
Method Summary
SearchTrail __construct (string $searchTrail)
void addAbsoluteAttribute (int $id, float $value, string $displayValue, string $operator)
void addAttribute (int $id, string $value)
void addCategory (int $id)
void addChildCategory (int $id, string $value)
void addDisplayCategory (int $id)
void addKeyword (string $keyword)
void addManufacturer (int $id, string $value)
void addParentCategory (int $id, string $value)
void clear ()
boolean contains (string $keyword)
boolean containsOperator (string $value)
array getDisplayTrial ( $categories,  $manufactures)
string getOperator (string $value)
string getTrialString ()
boolean isCategoryFilterExists (string $trailString)
string prepareChildCategoryFilter (string $trail)
string prepareDisplayCategoryFilter (string $trail)
string prepareParentCategoryFilter (string $trail)
void remove (int $id, string $type)
decoded_trail removeSpecialCharacters (string $trail)
string toParameterString (string $action)
Variables
static mixed $ABSOLUTE_ATTRIBUTE_DISPLAY_FILTER = "&absoluteDisplay=" (line 80)
  • access: public
static mixed $ATTRIBUTE_FILTER = "&attributeFilter=" (line 79)
  • access: public
static mixed $CATEGORY_FILTER_ID = "&categoryFilterId=" (line 77)
  • access: public
static mixed $CHILD_CATEGORY_FILTER_ID = "&childcategoryFilterId=" (line 75)
  • access: public
static mixed $DISPLAY_CATEGORY_FILTER_ID = "&displaycategoryFilterId=" (line 76)
  • access: public
static mixed $EQUALTO = 0 (line 84)

Operator contants for absolute attributes.

  • access: public
static mixed $GREATERTHAN_OR_EQUAL_TO = 1 (line 85)
  • access: public
static mixed $KEYWORD_FILTER = "&keywordFilter=" (line 73)

Contant Query paramter keys for all criteria/filters support by SearchTrail

  • access: public
static mixed $LESSTHAN_OR_EQUAL_TO = 2 (line 86)
  • access: public
static mixed $MANUFACTURER_FILTER_ID = "&manufacturerFilterId=" (line 78)
  • access: public
static mixed $PARENT_CATEGORY_FILTER_ID = "&parentcategoryFilterId=" (line 74)
  • access: public
Methods
Constructor __construct (line 93)

SearchTrail object contructor.

  • access: public
SearchTrail __construct (string $searchTrail)
  • string $searchTrail
addAbsoluteAttribute (line 196)

Add absolute attribute in SearchTrail. Absolute attributes computes by there value and operator.

multiple absolute attribtues are added in AND fashion.

  • access: public
void addAbsoluteAttribute (int $id, float $value, string $displayValue, string $operator)
  • int $id
  • float $value
  • string $displayValue
  • string $operator
addAttribute (line 179)

Add attribute id and value in SearchTrail those are use in search. Multiple attributes are added in the SearchTrail by adding $ATTRIBUTE_FILTER in AND fashion.

  • access: public
void addAttribute (int $id, string $value)
  • int $id
  • string $value
addCategory (line 129)

Add category id in the SearchTrail those are used in search. Multiple categores are added in the SearchTrail by adding $CATEGORY_FILTER_ID in AND fashion.

  • access: public
void addCategory (int $id)
  • int $id
addChildCategory (line 155)

Add child category id in SearchTrail those are used in search. Child Category are just a collection of category ids those are replaced by category ids when trial is append to WebService request. Its only used to distingush between filters those of normal category criteria or child category criteria.

  • access: public
void addChildCategory (int $id, string $value)
  • int $id
  • string $value
addDisplayCategory (line 118)

Add display category id in SearchTrail those are used in search. DiplayCategory are just a collection of category ids those are replaced by category ids when trial is append to WebService request. Its only used to distingush between filters those of normal category criteria or display category criteria.

  1. For e.gdipslaycategoryFilterId=id

  • access: public
void addDisplayCategory (int $id)
  • int $id
addKeyword (line 104)

This method update the SearchTrail with the keyword passed and fitler the result base on that keyword.

It will add keyword along with its required paramter key.

  • access: public
void addKeyword (string $keyword)
  • string $keyword
addManufacturer (line 167)

Add manufacturer id in SearchTrail those are used in search. Multiple manufactures are added in the SearchTrail by adding $MANUFACTURER_FILTER_ID in AND fashion.

  • access: public
void addManufacturer (int $id, string $value)
  • int $id
  • string $value
addParentCategory (line 142)

Add parent category id in SearchTrail those are used in searchParentCategory are just a collection of category ids those are replaced by category ids when trial is append to WebService request. Its only used to distingush between filters those of normal category criteria or parent category criteria.

  • access: public
void addParentCategory (int $id, string $value)
  • int $id
  • string $value
clear (line 248)

Clear the SearchTrail. All the filter added in the trail are clear and resets the whole search.

  • access: public
void clear ()
contains (line 617)

Check that supplied keyword is available in the particular array.

  • access: public
boolean contains (string $keyword)
  • string $keyword
containsOperator (line 634)

Check that operator is avalable in the gives value.

  • access: public
boolean containsOperator (string $value)
  • string $value
getDisplayTrial (line 472)

Return List of Filters/Criteria available in SearchTrail to display.

  • access: public
array getDisplayTrial ( $categories,  $manufactures)
  • $categories
  • $manufactures
getOperator (line 650)

Return the specific operator present in the given value.

  • return: operator
  • access: public
string getOperator (string $value)
  • string $value
getTrialString (line 311)

Return url string representation of trail that is use in filtering requests. Its will return all the paramters present in trail irrespective of their types those are meaningful for web service request.

  • return: parameteric url
  • access: public
string getTrialString ()
isCategoryFilterExists (line 260)

Check that the given trail contains any category filter id. Returns true if the trail contains category filter id else return false.

  • access: public
boolean isCategoryFilterExists (string $trailString)
  • string $trailString
prepareChildCategoryFilter (line 441)

This method prepare the trail for web service request and replace all child category ids with category ids.

  • access: public
string prepareChildCategoryFilter (string $trail)
  • string $trail
prepareDisplayCategoryFilter (line 425)

This method prepare the trail for web service request and replace all display category ids with category ids.

  • access: public
string prepareDisplayCategoryFilter (string $trail)
  • string $trail
prepareKeywordFilter (line 325)

This method will collect all keywords from the trail and prepare them to pass to web service request.

The SearchTrail holds keyword in kw parameter that will convert to actuall keyworFilter parameter before sending the paramter string to web service request.

  • see: SearchTrail->toParameterString.
  • access: public
string prepareKeywordFilter ()
prepareParentCategoryFilter (line 457)

This method prepare the trail for web service request and replace all parent category ids with category ids.

  • access: public
string prepareParentCategoryFilter (string $trail)
  • string $trail
prepareTrailWithoutDisplayParameters (line 364)

This method is used to remove all paramters those have only used to display there values not used by web service at all.

  • access: public
string prepareTrailWithoutDisplayParameters ()
prepareTrailWithoutDisplayParameters1 (line 397)
  • access: public
void prepareTrailWithoutDisplayParameters1 ()
remove (line 217)

Remove give filter type from the SearchTrail.

  • access: public
void remove (int $id, string $type)
  • int $id
  • string $type: filter $type
removeSpecialCharacters (line 349)

This method will remove any special characters in the SearchTrail generated trialString. Current URLDecoding unable to decode there special charaters.

  • access: public
decoded_trail removeSpecialCharacters (string $trail)
  • string $trail
toParameterString (line 281)

Return string contaning paramters that are use in filtering requests. This method remove all parameters those are used only to maintains trail filters and distinguish between there types. The results trail that used in Web Service request not requires those parameters.

The Parameter action used to check that the request comming from client is from category filter.

  • return: parameters_url
  • access: public
string toParameterString (string $action)
  • string $action

Documentation generated on Wed, 13 Feb 2008 01:57:41 +0500 by phpDocumentor 1.4.0a2