Open Journal Systems  3.3.0
SubmissionSearch Class Reference
Inheritance diagram for SubmissionSearch:
ArticleSearch

Public Member Functions

 __construct ()
 
 _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)
 
 formatResults ($results, $user=null)
 
 getResultSetOrdering ($request)
 
 getResultSetOrderingDirectionOptions ()
 
 getResultSetOrderingOptions ($request)
 
 retrieveResults ($request, $context, $keywords, &$error, $publishedFrom=null, $publishedTo=null, $rangeInfo=null, $exclude=array())
 

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.

Constructor & Destructor Documentation

◆ __construct()

SubmissionSearch::__construct ( )

Constructor

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

Member Function Documentation

◆ _getMergedArray()

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().

◆ _getMergedKeywordResults()

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().

◆ _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().

◆ _parseQuery()

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(), and PKPString\regexp_match_all().

Referenced by retrieveResults().

◆ _parseQueryInternal()

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 Application\getSubmissionSearchIndex(), and PKPString\strtolower().

Referenced by _parseQuery().

◆ formatResults()

SubmissionSearch::formatResults (   $results,
  $user = null 
)
abstract

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.

Parameters
$resultsarray
$userUser optional (if availability information is desired)
Returns
array

Reimplemented in ArticleSearch.

Referenced by retrieveResults().

◆ getDefaultOrderDir()

SubmissionSearch::getDefaultOrderDir (   $orderBy)
abstractprotected

Return the default order direction.

Parameters
$orderBystring
Returns
string

Reimplemented in ArticleSearch.

Referenced by getResultSetOrdering().

◆ 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().

◆ getResultSetOrderingDirectionOptions()

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().

◆ getResultSetOrderingOptions()

SubmissionSearch::getResultSetOrderingOptions (   $request)
abstract

Return the available options for result set ordering.

Parameters
$requestRequest
Returns
array

Reimplemented in ArticleSearch.

Referenced by getResultSetOrdering().

◆ getSearchDao()

SubmissionSearch::getSearchDao ( )
abstractprotected

Return the search DAO

Returns
DAO

Reimplemented in ArticleSearch.

Referenced by _getMergedPhraseResults().

◆ getSparseArray()

SubmissionSearch::getSparseArray (   $unorderedResults,
  $orderBy,
  $orderDir,
  $exclude 
)
abstractprotected

See implementation of retrieveResults for a description of this function.

Reimplemented in ArticleSearch.

Referenced by retrieveResults().

◆ 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 submission, issue, context, etc.

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

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


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