| Constructor | Description |
|---|---|
WinkSearchControl() |
Creates a new search control object. The search control object is a container for searchers, objects which implement the WinkSearch interface. The search control object is not operational until is has at least one searcher child. A search control is bound to an html container using the .draw() method.
The expected order of operations is:
sc = new WinkSearchControl(); sc.addSearcher(); sc.draw(); Once these steps have occurred, the search control is active and ready to begin performing searches.
|
| Method | Description |
|---|---|
.draw(element) |
This method is the final step needed to activate a search control object. It may only be called once all searchers have been added into the search control. When called, this method produces the user interface, search result containers for each configured searcher, and finally sets of the various linkages needed to coordinate parallel searches across all of the searchers.
The method requires that the caller supply an html block element, typically a div element which the control draws within. The control operates best when provided with at least 300px of width and will scale reasonably well down to ~250px.
The default user interface style is a linear style where the control inputs are at the top followed by a linear set of stacked results. Optionally, callers may request a tabbed user interface which works well when vertical real estate is at a premium.
|
| Constructor | Description |
|---|---|
WinkSearchForm(enableClear, element) |
Creates a new search form object. The search form object supplies user interface elements, methods, properties, and callbacks designed to allow applications to control a collection of
WinkSearch() objects. The user interface and capabilities match whats available to applications using the WinkSearchControl() (in fact, the WinkSearchControl() is internally based on this object.The expected order of operations is:
sf = new WinkSearchForm(true/false, container); sf.setOnSubmitCallback(object, method); optional - sf.setOnClearCallback(object, method); Once these steps have occurred, the search form is active and ready to begin receiving and processing user input.
The method accepts a required enableClear argument as well as a required element argument
|
| Method | Description |
|---|---|
.setOnSubmitCallback(object, method) |
This method registers an object/method combination that is called when the search form is "submitted". This event occurs when the user clicks on the search button, or when the user hits enter while focused on the text input element. When this occurs, the specified object becomes the active object and the specified method is called. The argument passed to the method is this search form.
A typical method might look like this:
App.prototype.onSubmit = function(form) {
if (form.input.value) {
this.localSearcher.execute(form.input.value);
}
return false;
}
Note in the above example that the search form is passed to the method, and that the method returns false indicating that it has processed the submit event.
|
.setOnClearCallback(object, method) |
This method registers an object/method combination that is called when the clear button in the search form is pressed. It is an error to call this method if the search form was created without a clear button. When this occurs, the specified object becomes the active object and the specified method is called. The argument passed to the method is this search form.
A typical method might look like this:
App.prototype.onClear = function(form) {
this.myClearFunction();
return false;
}
Note in the above example that the search form is passed to the method, and that the method returns false indicating that it has processed the clear event.
|
.execute(opt_string? || opt_query?) |
This method allows an application to "submit" the form. This involves optionally setting the form's text input element and then calling the registered on-submit callback method established using
.setOnSubmitCallback().
|
| Constructor | Description |
|---|---|
WinkPeopleSearch() |
Creates a new searcher object. Note: Since this is a base class, it is unlikely that applications will make direct use of this constructor and instead will use the constructor as a side effect of creating a service specific searcher object (e.g.,
WinkPeopleSearch).
|
| Method | Description |
|---|---|
.setResultSetSize(indicator) |
|
.getResultSetSize() |
|
.clearResults() |
Upon successful completion of a search, the searcher object holds on to a collection of search results which describe the outcome of a particular search. This method is used to reset the searcher, clearing out all results. This method is implicitly called prior to the execution of a new search.
|
.execute(query) |
This method is called to begin a new search. The query (either a WinkQueryObject or a string) argument supplies the search term. Upon completion, the object becomes populated with the corresponding set of results, and the registered search completion handler is called.
|
.setSearchCompleteCallback(object, method, opt_arguments?) |
This method is used to register and object and method to notify on the completion of a search. Applications may optionally pass in a context argument using opt_arguments which is then passed to the specified method.
|
.setUserDefinedLabel(label) |
stub - no functionality is performed |
.setUserDefinedClassSuffix(classSuffix) |
This method is used to set a user defined class suffix for the search results section, and for the collection of search results produced by this searcher in the search control. The motivation for this method is to allow applications to set unique styling for the results and header of a particular set of search results. Assuming this method is called with a value of "siteSearch", a class of
wink-resultsRoot-siteSearch will be applied to the DIV element that wraps the header and results associated with this searcher. Note, this is in addition to the generic wink-resultsRoot class.
|
.setLinkTarget(linkTarget) |
This method is called to set the link target used for links embedded in search results. The default value is
WinkSearch.LINK_TARGET_BLANK which specifies that links will open in a new browser window. When a searcher is added to a search control, the search control makes an implicit call to this method using the current link target setting for the search control. This means that if your application needs a searcher to operate with a different link target setting than the setting established by the search control, you need to call this method after adding the searcher to the search control.
|
.setNoHtmlGeneration() |
There are times when your application is not using the search control and is only using a small set of properties from a search result and you are displaying these in a highly customized format. When this is the case, a small optimization is available to your application. The searcher can be programmed to NOT generate a .html property leaving you with only the raw properties valid in a result.
|
.getAttribution() |
stub function
|
.setQueryAddition(term) |
|
.createResultHtml(result) |
This method allows the caller to either create, or re-generate the .html property of the specified result. Sometimes this is needed when the caller had previously use .setNoHtmlGeneration(), or when the caller is reloading a result object from its own storage system.
|
| Method | Description |
|---|---|
.getBranding(opt_element?, opt_orientation?) |
This method is a static helper function that returns a "powered by Wink" HTML DOM branding node to your application, and optionally attaches it to your document as the only child of the specified optional element. The purpose of this method is to ensure that your application has a simple way to comply with branding requirements in situations where using wither the search form in the WinkSearchControl or in the WinkSearchForm is not appropriate for your application.
|
.setOnLoadCallback(handler) |
This method is a static helper function that registers the specified handler function to be called once the document containing this call loads. Previous documentation recomended that you use the body element's onload attribute (e.g.,
<body onload="OnLoad()">. While this is a fine way to go when you are in complete control of the page and all code loaded by the page, this approach can cause problems with some runtimes to destroy your body.onload handler. The setOnLoadCallback() approach does not have these problems and therefore is our recomended way of registiring a callback that calls your code upon document load (a point in time when the AJAX Search APIs are fully loaded and ready for use).
|
| Method | Description |
|---|---|
.results[] |
This property contains an array of search result objects, one for each result. Each time a search executes, this property is cleared, and each time a search completes, the array is populated. If there are no results to report, the .length property of this array will be set to 0.
|
GSearch interface) over the Wink People Search service. Upon completion of a search it delivers a collection WinkPeopleResults objects (compatable with GwebResults).| Constructor | Description |
|---|---|
WinkPeopleSearch() |
The constructor is used to create an instance of a searcher object designed to provide search results from the Wink People Search service.
|
| Method | Description |
|---|---|
none |
no addtional methods are available at this time. (aka "this page intentionally left blank")
|
.GsearchResultClass - specifies the type of result
.html - supplies the root of an html element that may be cloned and attached somewhere into the applications DOM hierarchy.
| Common Property | Description |
|---|---|
.GSearchResultClass |
WinkPeopleSearch.RESULT_CLASS - indicates WinkPeopleResult |
.html |
Supplies the root of an html element that may be cloned and attached somewhere into the applications DOM hierarchy. We expect that this is the primary property that applications will be concerned with and that their typical interaction will involve cloning this node an attaching it into their DOM hierarchy. We expect that they will use css to control styling and to control which elements are displayed. For instance, we expect the following fragment to be common across all applications that wish to copy and past search results delivered through the Wink AJAX People Search API.
// clone the .html node from the result var node = result.html.cloneNode(true); // attach the node into my dom container.appendChild(node) |
| Property | Description |
|---|---|
.qn |
Name to query (e.g. "John Q. Public") |
.qi |
Interest to query (e.g. "kitboarding") |
.l |
location to query (e.g. Los Altos, CA) |
| Property | Description |
|---|---|
.click_url |
Supplies the raw URL of the result |
.gender |
Either "male" or "female" or "". |
.age |
Interger age for this person. |
.summary |
A descriptive summary for this person. |
.image_url |
Supplies the raw URL to the profile image. |
.geo.title |
Supplies the title for the result. In some cases, the title and the streetAddress are the same. This typically occurs when the search term is a street address such as Los Altos, CA. |
.geo.lat |
Supplies the latitude value of the result. Note: in some cases this property may be set to ''. |
.geo.lng |
Supplies the longitude value of the result. Note: in some cases this property may be set to ''. |
.geo.city |
Supplies a city name for the result. Note: in some cases, this property may be set to "". |
.geo.region |
Supplies a region name for the result (typically state or province). Note: in some cases, this property may be set to "". |
.geo.country |
Supplies a country name for the result. Note: in some cases, this property may be set to "". |
.places[] |
Supplies an array of places that this user can be found at, where each object contains a .title property and a .url property. |