| Package | net.guttershark.util.autosuggest |
| Class | public class AutoSuggest |
The AutoSuggest class searches through the provided a list of terms for a specific search term.
As an example. Assume you had this list of words to search through:
Now assume you started typing "Fl", the AutoSuggest instance would return an array of AutoSuggestMatches. The two that matched were Flash and Flex.
See also
| Property | Defined by | ||
|---|---|---|---|
| terms : Array [write-only]
Set the terms to search through.
| AutoSuggest | ||
| Method | Defined by | ||
|---|---|---|---|
|
AutoSuggest(terms:Array, caseSensitive:Boolean = false)
Constructor for AutoSuggest instances.
| AutoSuggest | ||
|
dispose():void
Dispose of internal objects in memory.
| AutoSuggest | ||
|
search(term:String, returnLowercaseMatches:Boolean = true):Array
Search through the terms in this auto suggest instance for a particular
word or phrase.
| AutoSuggest | ||
| terms | property |
terms:Array [write-only]Set the terms to search through.
Implementation public function set terms(value:Array):void
| AutoSuggest | () | constructor |
public function AutoSuggest(terms:Array, caseSensitive:Boolean = false)Constructor for AutoSuggest instances.
Parametersterms:Array — An array of strings to search through.
|
|
caseSensitive:Boolean (default = false) — If case sensitivity matters.
|
— ArgumentError If the terms array is null.
|
| dispose | () | method |
public function dispose():voidDispose of internal objects in memory.
| search | () | method |
public function search(term:String, returnLowercaseMatches:Boolean = true):ArraySearch through the terms in this auto suggest instance for a particular word or phrase.
Example usage:
import net.guttershark.util.autosuggest.AutoSuggest;
var terms:Array = [
"George Bush", "Chaotmic Matter", "Particle Effects", "Word up",
"Gangsta", "The Tony Danza Tap Dance Extravaganza", "Good bye",
"Goodby","Gaa"
];
var ast:AutoSuggest = new AutoSuggest(terms,false);
var a:= ast.search("The Tony",true);
trace(a[0].term);
trace(a[0].highlightedTerm);
var b:= ast.search("G",true)
trace(b.length);
for(var i:int = 0; i < b.length; i++)
{
trace(b[i].term + " :: " + b[i].highlightedTerm);
}
term:String — The term to search for.
|
|
returnLowercaseMatches:Boolean (default = true) — Return all lowercase matches.
|
Array — Array An array of AutoSuggestMatches.
|
See also