Inherits from STPagingSearchResultsObject : STSearchResultsObject : NSObject
Declared in STCommonDocumentTypeResultsObject.h
STCommonDocumentTypeResultsObject.m

Overview

The STCommonDocumentTypeResultsObject is a helper used to render results from a DocumentType with common fields that must include “title” and “url”.

Since the engine key and DocumentType slug are passed as parameters 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 STCommonDocumentTypeResultsObject 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 STCommonDocumentTypeResultsObject 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 STCommonDocumentTypeResultsObject implements in addition to those implemented by STSearchResultsObject and STPagingSearchResultsObject:

  • STSearchResultsObject
  • searchResultsDataSource for UISearchDisplayController
    • tableView:titleForHeaderInSection: – returns nil
    • tableView:cellForRowAtIndexPath: – For suggest queries renders the title of the cell. For search queries renders the title and url as the subtitle.
  • searchResultsDelegate for UISearchDisplayController
    • tableView:didSelectRowAtIndexPath: – Opens up a web page of the result

Tasks

Other Methods

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:documentTypeSlug:

This is the designated initilizer for STCommonDocumentTypeResultsObject.

- (id)initWithViewController:(UIViewController *)controller clientEngineKey:(NSString *)engineKey documentTypeSlug:(NSString *)documentTypeSlug

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

documentTypeSlug

The slug of the the DocumentType that will be queried

Discussion

This is the designated initilizer for STCommonDocumentTypeResultsObject.

Declared In

STCommonDocumentTypeResultsObject.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