STPagingSearchResultsObject Class Reference
Inherits from | STSearchResultsObject : NSObject |
Declared in | STPagingSearchResultsObject.h STPagingSearchResultsObject.m |
Overview
The purpose of STPagingSearchResultsObject
is to extend the functionality STSearchResultsObject
to include the paging of results. Currently, “Load More” cells are only displayed on search queries
and not suggest queries when more pages are available. If multiple sections (displaying multiple
document types) are on the screen and the scope filtering is enabled then the “Load More” switches
from the “All” scope to that sections specific scope. See hasMorePagesInSection:
for more infomation
when a section is determined to have another page.
Keep in mind STPagingSearchResultsObject
is a subclass of STSearchResultsObject
. 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 STPagingSearchResultObject
implements in addition to
those implemented by STSearchResultsObject
:
searchResultsDataSource
forUISearchDisplayController
tableView:numberOfRowsInSection:
– Adds space for an extra cell if that section passes thehasMorePagesInSection:
test.tableView:cellForRowAtIndexPath:
– If the index path is that of a “Load More” cell then it returns a generic “Load More” cell. Otherwise it will return nil.tableView:didSelectRowAtIndexPath:
– If the selection was a “Load More” cell then it either switches to that section’s scope. If it is already in a specific document scope then it requests more results from the server and reloads the table view when the new results are available.
delegate
forSTAPIClient
client:didFinishQuery:withResult:withType:
– merges the new record data in with the current record data. Then makes a call tosuper
client:didFinishQuery:withResult:withType:
with the merged records as the result.
Tasks
Other Methods
-
– isIndexPathMoreCell:
Determines if the index path could be a load more cell. Which means the section has more pages and the row is the last index.
-
– loadNextSearchResultPage
Requests that the server load the next page of search result data. If the previous
searchType
was aSTSearchTypeSuggest
then this method is a no-op. -
– hasMorePagesInSection:
Determines if a specific section has more pages to load.
Other Methods
-
– initWithViewController:
This is the designated initilizer for
STSearchResultsObject
.
Instance Methods
hasMorePagesInSection:
Determines if a specific section has more pages to load.
- (BOOL)hasMorePagesInSection:(NSInteger)section
Parameters
- section
The section index to test
Return Value
BOOL
indicating if a section has more pages
The result will be true of the following condition are met:
-
searchType
isSTSearchTypeSearch
-
recordSectionOrder
length is greater than 0 - The number of rows in the section is greater than 0
- Current page is not the last pages
- The number of sections is greater than 0
- The number of sections is equal to 1 or if it is greater than 1 the scope bar allows filtering based on the document type.
Discussion
Determines if a specific section has more pages to load.
Declared In
STPagingSearchResultsObject.h
initWithViewController:
This is the designated initilizer for STSearchResultsObject
.
- (id)initWithViewController:(UIViewController *)controller
Parameters
- controller
The controller that the search results will be presented over. This is the same as the
UISearchDisplayControllers
searchContentsController
.If nil is passed to
controller
thenSTSearchResultsObject
will not create aUISearchDisplayController
. It is then the responsibility of the subclass to provide UI that renders the search results.
Discussion
This is the designated initilizer for STSearchResultsObject
.
Declared In
STSearchResultsObject.h
isIndexPathMoreCell:
Determines if the index path could be a load more cell. Which means the section has more pages and the row is the last index.
- (BOOL)isIndexPathMoreCell:(NSIndexPath *)indexPath
Parameters
- indexPath
Index path of the cell
Return Value
BOOL
indicating if the index path is a “Load More” cell
Discussion
Determines if the index path could be a load more cell. Which means the section has more pages and the row is the last index.
Declared In
STPagingSearchResultsObject.h
loadNextSearchResultPage
Requests that the server load the next page of search result data. If the previous searchType
was a
STSearchTypeSuggest
then this method is a no-op.
- (void)loadNextSearchResultPage
Discussion
Requests that the server load the next page of search result data. If the previous searchType
was a
STSearchTypeSuggest
then this method is a no-op.
Declared In
STPagingSearchResultsObject.h