Packageorg.servebox.toolbox.search
Classpublic class SearchTree

SearchTree enables indexing of array values to perform text searchs.

See also

com.lodh.utils.search.WordIndex
com.lodh.utils.search.SearchProperty


Public Properties
 PropertyDefined by
  OPERATOR_AND : Number = 0
[static]
SearchTree
  OPERATOR_OR : Number = 1
[static]
SearchTree
Protected Properties
 PropertyDefined by
  logger : ILogger
[static] The class logger.
SearchTree
Public Methods
 MethodDefined by
  
Constructor.
SearchTree
  
addObjectToIndex(obj:IBasicObject, properties:Array):void
Adds an object to the index.
SearchTree
  
clearIndex():void
Deletes the index.
SearchTree
  
getObjects(searchExpression:String, operator:Number = 0):Array
Performs a search and returns results as an Array.
SearchTree
  
index(objs:Array, properties:Array):void
Add objects to the index.
SearchTree
  
search(searchExpression:String, operator:Number = 0):DictionaryTable
Performs a search.
SearchTree
  
setWordsSeparators(seps:Array):void
Sets the characters used to identify words terminations during index.
SearchTree
Property detail
loggerproperty
protected static var logger:ILogger

The class logger.

OPERATOR_ANDproperty 
public static var OPERATOR_AND:Number = 0
OPERATOR_ORproperty 
public static var OPERATOR_OR:Number = 1
Constructor detail
SearchTree()constructor
public function SearchTree()

Constructor.

Method detail
addObjectToIndex()method
public function addObjectToIndex(obj:IBasicObject, properties:Array):void

Adds an object to the index. The object to index should implement the IBasicObject interface.

Parameters
obj:IBasicObject — The object to add.
 
properties:Array — An array containing the names of the properties to index (SearchProperty).

See also

com.lodh.utils.IBasicObject
clearIndex()method 
public function clearIndex():void

Deletes the index.

getObjects()method 
public function getObjects(searchExpression:String, operator:Number = 0):Array

Performs a search and returns results as an Array.

Parameters
searchExpression:String — The expression to search for.
 
operator:Number (default = 0) — The logical operator to use to combine results ({

Returns
Array — An Array containing results.
index()method 
public function index(objs:Array, properties:Array):void

Add objects to the index. The objects to index should implement the IBasicObject interface.

Parameters
objs:Array — The objects to add.
 
properties:Array — An array containing the names of the properties to index (SearchProperty).

See also

com.lodh.utils.IBasicObject
search()method 
public function search(searchExpression:String, operator:Number = 0):DictionaryTable

Performs a search.

Parameters
searchExpression:String — The expression to search for.
 
operator:Number (default = 0) — The logical operator to use to combine results ({

Returns
DictionaryTable — A DictionaryTable containing results. Keys are objects hash codes.
setWordsSeparators()method 
public function setWordsSeparators(seps:Array):void

Sets the characters used to identify words terminations during index.

Parameters
seps:Array