STPageDocumentTypeResultsObject Class Reference
Inherits from | STPagingSearchResultsObject : STSearchResultsObject : NSObject |
Declared in | STPageDocumentTypeResultsObject.h STPageDocumentTypeResultsObject.m |
Overview
The STPageDocumentTypeResultsObject
is a helper used to render the results of a crawled website.
Since the engine key is passed as a parameter there shouldn’t be a need to subclass for most cases.
It is still required to subclass if it is required to render custom cells or handle clicks in a
specific way.
Out of the box STPageDocumentTypeResultsObject will handle paging, render the results of suggest and search queries, display a web view controller when one of the results is clicked and post back analytics about which items were selected.
Keep in mind STPageDocumentTypeResultsObject
is a subclass of STPagingSearchResultsObject
. When
overriding methods or pointing delegate
or dataSource
at new objects there maybe helpful
functionality that is disabled as a result. It might be necessary to call super
or call the
delegate
or dataSource
callbacks implemented by STPagingSearchResultsObject
to preserver
some of this functionality.
Here is a list of the delegate methods that STPageDocumentTypeResultsObject
implements in addition to
those implemented by STSearchResultsObject
and STPagingSearchResultsObject
:
-
STSearchResultsObject
recordSectionOrder
– returns@[ @"page" ]
instead of the empty array
-
searchResultsDataSource
forUISearchDisplayController
tableView:titleForHeaderInSection:
– returns niltableView:cellForRowAtIndexPath:
– For suggest queries renders the title of the cell. For search queries renders the title and url as the subtitle.
-
searchResultsDelegate
forUISearchDisplayController
tableView:didSelectRowAtIndexPath:
– Opens up a web page of the result
NOTE: You may wish to use STCommonDocumentTypeResultsObject instead, as it is more generic.
Tasks
Other Methods
-
– initWithViewController:clientEngineKey:
This is the designated initilizer for
STPageDocumentTypeResultsObject
.
Other Methods
-
– recordSectionOrder
Subclasses override this method to provide an array of document type names and the order the document types should be rendered in the search results table view.
-
– clientEngineKey
This method should be overriden by subclasses to return
Instance Methods
clientEngineKey
This method should be overriden by subclasses to return
- (NSString *)clientEngineKey
Return Value
A NSString
of the search engine that will be queried against
Discussion
This method should be overriden by subclasses to return
Declared In
STSearchResultsObject.h
initWithViewController:clientEngineKey:
This is the designated initilizer for STPageDocumentTypeResultsObject
.
- (id)initWithViewController:(UIViewController *)controller clientEngineKey:(NSString *)engineKey
Parameters
- controller
The controller that the search results will be presented over. This is the same as the UISearchDisplayControllers searchContentsController.
- engineKey
The key of the engine that will be queried
Discussion
This is the designated initilizer for STPageDocumentTypeResultsObject
.
Declared In
STPageDocumentTypeResultsObject.h
recordSectionOrder
Subclasses override this method to provide an array of document type names and the order the document types should be rendered in the search results table view.
- (NSArray *)recordSectionOrder
Return Value
An array of NSString
objects that represent the document type keys.
By default this method will return an empty array. This method is required to
return the keys of the document types for various helper aspects of the STSearchResultsObject
to work properly. It is required for recordTypeForSection:
to return the document type for a
particular section index. It is also required for the UITableViewDataSource
methods
numberOfSectionsInTableView:
and tableView:numberOfRowsInSection:
which are overridden by
STSearchResultsObject
to provide the section and row counts based on the search result data.
The result of this method is also used when automatically setting up the search scope bar.
Every suggest or search query will contain a dictionary called record
. Within record
each key will be the name of the document type.
Discussion
Subclasses override this method to provide an array of document type names and the order the document types should be rendered in the search results table view.
Declared In
STSearchResultsObject.h