FFRIndexed::Template - Render and interactively refine a FFRIndexed query (name to change)
A likely good name would maybe be FFRIndexed::View or something like that, as it's a class conveniently usable from any templating system that has method calls on objects.
__PACKAGE__->new ARGSCreates a new view. The following parameters are optional but allowed:
indexThe FFRIndexed file index to use. If none is given, one will be instantiated.
queryThe query (as data structure) to use.
Default is [].
default_categoryThe default category to use.
columnsThe columns to display.
orderThe order in which the columns are displayed.
refinerAn instance of Table::Denormalized::ColumnRefiner
persistent_paramsList of the parameters which persist over queries. This is used to append/discard CGI parameters from the query string. If none is given, a new instance of CGI::PersistentParams is created with the following columns to discard:
action _id super_search Search column template ss _
items_per_pageThe number of items per page. Default is 20.
pageThe page to display. Default is 0.
pagerThe pager object to use. Default is a new instance of Data::Page
ajaxThe HTML::Prototype object to use. Default is a new instance.
$view->link $ARGREFReturns a link to the current query, modified by $ARGREF, suitable for use from within Template Toolkit. Very convenient if you want to page through a sorted set. All CGI query parameters are preserved. If you want to erase a parameter, pass <tt>undef</tt> in the argument.
$view->hidden $ARGREFReturns a list of hidden parameters of the current query from persistent_params, as modified by $ARGREF. Convenient for inclusion in a form.
$view->plugins TYPEReturns the list of available plugins of the given type. The type can be one of
page ... ...
$view->refinementsReturns the list of refinements for the current query.
$view->implicit_columnsReturns the list of the columns that were not explicitly named in the query, but still add no subdivision to the results.
explicit_columnsReturns the names of the columns mentioned explicitly in the query. This needs to be set in the constructor, otherwise some dodgy and untested logic will be used that will likely mistreat SuperSearches, as these potentially mention many columns.
$view->refinement $COLUMNReturns the refinement for the column $COLUMN
$view->refining_columnsReturns the refining columns for the current query.
$view->columnsReturns all columns
$view->interesting_columnsReturns all non-trivial columns from the set of given columns. Using this should somehow differentiate from user-requested columns and determined columns. Some day.
Maybe "refining columns" should take a list of admissible columns. The the two functions could be merged into one function.
$view->resultset START, COUNTInitializes and retrieves the full resultset from the database. It returns the resultset as an array reference. This is currently overkill as only the overall size of the resultset and the items on the "current page" are actually needed.
This method will later return only the count and the "relevant" rows and not retrieve everything from the database.
Or maybe not, as the Playlist plugin relies on the fact that all rows are available.
$view->resultset_list START, COUNTSame as resultset, except that it returns a list instead of an array reference.
$view->current_contentReturns the next COUNT items after START. This is convenient to implement the concept of a "current page", for example using Data::Pager.
$view->pagerReturns a Data::Page object for convenient paging through the resultset.
$view->keyword_complete KEYWORD COLUMNSReturns a (unique) list of matching keywords from the current_content.
The matching is done via case insensitive substring matching.
This should likely go somewhere else separate instead of being part of this module.