Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
SubmissionSearch Class Reference
Inheritance diagram for SubmissionSearch:
MonographSearch

Public Member Functions

 _getMergedArray ($context, &$keywords, $publishedFrom, $publishedTo)
 
 _getMergedKeywordResults ($context, &$keyword, $type, $publishedFrom, $publishedTo, $resultsPerKeyword, $resultCacheHours)
 
 _getMergedPhraseResults ($context, &$phrase, $type, $publishedFrom, $publishedTo, $resultsPerKeyword, $resultCacheHours)
 
 _parseQuery ($query)
 
 _parseQueryInternal ($signTokens, $tokens, &$pos, $total)
 
 getResultSetOrdering ($request)
 
 getResultSetOrderingDirectionOptions ()
 
 getResultSetOrderingOptions ($request)
 
 retrieveResults ($request, $context, $keywords, &$error, $publishedFrom=null, $publishedTo=null, $rangeInfo=null, $exclude=array())
 
 SubmissionSearch ()
 

Static Public Member Functions

static formatResults (&$results)
 

Protected Member Functions

 getDefaultOrderDir ($orderBy)
 
 getSearchDao ()
 
getSparseArray (&$unorderedResults, $orderBy, $orderDir, $exclude)
 

Detailed Description

Class for retrieving search results.

See Also
SubmissionSearchDAO

FIXME: NEAR; precedence w/o parens?; stemming; weighted counting

Definition at line 35 of file SubmissionSearch.inc.php.

Member Function Documentation

SubmissionSearch::_getMergedArray (   $context,
$keywords,
  $publishedFrom,
  $publishedTo 
)

Takes an unordered list of search result data, flattens it, orders it and excludes unwanted results.

Parameters
$unorderedResultsarray An unordered list of search data (article ID as key and ranking data as values).
$orderBystring One of the values returned by ArticleSearch::getResultSetOrderingOptions();
$orderDirstring 'asc' or 'desc', see ArticleSearch::getResultSetOrderingDirectionOptions();
$excludearray A list of article IDs to exclude from the result.
Returns
array An ordered and flattened list of article IDs.

Definition at line 117 of file SubmissionSearch.inc.php.

References _getMergedKeywordResults(), and Config\getVar().

Referenced by retrieveResults().

SubmissionSearch::_getMergedKeywordResults (   $context,
$keyword,
  $type,
  $publishedFrom,
  $publishedTo,
  $resultsPerKeyword,
  $resultCacheHours 
)

Recursive helper for _getMergedArray.

Definition at line 138 of file SubmissionSearch.inc.php.

References _getMergedPhraseResults().

Referenced by _getMergedArray(), and _getMergedPhraseResults().

SubmissionSearch::_getMergedPhraseResults (   $context,
$phrase,
  $type,
  $publishedFrom,
  $publishedTo,
  $resultsPerKeyword,
  $resultCacheHours 
)

Recursive helper for _getMergedArray.

Definition at line 192 of file SubmissionSearch.inc.php.

References _getMergedKeywordResults(), and getSearchDao().

Referenced by _getMergedKeywordResults().

SubmissionSearch::_parseQuery (   $query)

Parses a search query string. Supports +/-, AND/OR, parens

Parameters
$query
Returns
array of the form ('+' => <required>, '' => <optional>, '-' => excluded)

Definition at line 48 of file SubmissionSearch.inc.php.

References _parseQueryInternal().

Referenced by retrieveResults().

SubmissionSearch::_parseQueryInternal (   $signTokens,
  $tokens,
$pos,
  $total 
)

Query parsing helper routine. Returned structure is based on that used by the Search::QueryParser Perl module.

Definition at line 58 of file SubmissionSearch.inc.php.

References String\strtolower().

Referenced by _parseQuery().

static SubmissionSearch::formatResults ( $results)
static

See implementation of retrieveResults for a description of this function.

Note that this function is also called externally to fetch results for the title index, and possibly elsewhere.

Returns
array

Definition at line 348 of file SubmissionSearch.inc.php.

Referenced by retrieveResults().

SubmissionSearch::getDefaultOrderDir (   $orderBy)
protected

Return the default order direction.

Parameters
$orderBystring
Returns
string

Definition at line 374 of file SubmissionSearch.inc.php.

Referenced by getResultSetOrdering().

SubmissionSearch::getResultSetOrdering (   $request)

Return the currently selected result set ordering option (default: descending relevance).

Parameters
$requestRequest
Returns
array An array with the order field as the first entry and the order direction as the second entry.

Definition at line 318 of file SubmissionSearch.inc.php.

References getDefaultOrderDir(), getResultSetOrderingDirectionOptions(), and getResultSetOrderingOptions().

Referenced by retrieveResults().

SubmissionSearch::getResultSetOrderingDirectionOptions ( )

Return the available options for the result set ordering direction.

Returns
array

Definition at line 303 of file SubmissionSearch.inc.php.

Referenced by getResultSetOrdering().

SubmissionSearch::getResultSetOrderingOptions (   $request)

Return the available options for result set ordering.

Parameters
$requestRequest
Returns
array

Definition at line 357 of file SubmissionSearch.inc.php.

Referenced by getResultSetOrdering().

SubmissionSearch::getSearchDao ( )
protected

Return the search DAO

Returns
DAO

Definition at line 382 of file SubmissionSearch.inc.php.

Referenced by _getMergedPhraseResults().

& SubmissionSearch::getSparseArray ( $unorderedResults,
  $orderBy,
  $orderDir,
  $exclude 
)
protected

See implementation of retrieveResults for a description of this function.

Definition at line 365 of file SubmissionSearch.inc.php.

Referenced by retrieveResults().

SubmissionSearch::retrieveResults (   $request,
  $context,
  $keywords,
$error,
  $publishedFrom = null,
  $publishedTo = null,
  $rangeInfo = null,
  $exclude = array() 
)

Return an array of search results matching the supplied keyword IDs in decreasing order of match quality. Keywords are supplied in an array of the following format: $keywords[SUBMISSION_SEARCH_AUTHOR] = array('John', 'Doe'); $keywords[SUBMISSION_SEARCH_...] = array(...); $keywords[null] = array('Matches', 'All', 'Fields');

Parameters
$requestRequest
$contextobject The context to search
$keywordsarray List of keywords
$errorstring a reference to a variable that will contain an error message if the search service produces an error.
$publishedFromobject Search-from date
$publishedToobject Search-to date
$rangeInfoInformation on the range of results to return
$excludearray An array of article IDs to exclude from the result.
Returns
VirtualArrayIterator An iterator with one entry per retrieved article containing the article, published article, issue, context, etc.

Definition at line 231 of file SubmissionSearch.inc.php.

References _getMergedArray(), _parseQuery(), HookRegistry\call(), formatResults(), getResultSetOrdering(), and getSparseArray().

SubmissionSearch::SubmissionSearch ( )

Constructor

Definition at line 39 of file SubmissionSearch.inc.php.


The documentation for this class was generated from the following file: