Class cSearchResult
CONTENIDO API - SearchResult Object
This object ranks and displays the result of the indexed fulltext search. If you are not comfortable with this API feel free to use your own methods to display the search results. The search result is basically an array with article ID's.
If $search_result = $search->searchIndex($searchword, $searchwordex);
use object with
$oSearchResults = new cSearchResult($search_result, 10);
$oSearchResults->setReplacement('', ''); // html-tags to emphasize the located searchwords
$num_res = $oSearchResults->getNumberOfResults(); $num_pages = $oSearchResults->getNumberOfPages(); $res_page = $oSearchResults->getSearchResultPage(1); // first result page foreach ($res_page as $key => $val) { $headline = $oSearchResults->getSearchContent($key, 'HTMLHEAD'); $first_headline = $headline[0]; $text = $oSearchResults->getSearchContent($key, 'HTML'); $first_text = $text[0]; $similarity = $oSearchResults->getSimilarity($key); $iOccurrence = $oSearchResults->getOccurrence($key); }
- cSearchBaseAbstract
- cSearchResult
Copyright: four for business AG <www.4fb.de>
License: http://www.contenido.org/license/LIZENZ.txt
Author: Willi Man
Located at classes/search/class.search.result.php
public
|
#
__construct( array $search_result, integer $result_per_page,
Compute ranking factor for each search result and order the search results by ranking factor NOTE: The ranking factor is the sum of occurences of matching searchterms weighted by similarity (in %) between searchword and matching word in the article. TODO: One can think of more sophisticated ranking strategies. One could use the content type information for example because a matching word in the headline (CMS_HEADLINE[1]) could be weighted more than a matching word in the text (CMS_HTML[1]). |
public
|
|
public
string
|
|
public
string
|
|
public
array
|
|
public
integer
|
|
public
integer
|
|
public
integer
|
|
public
number
|
|
public
|
|
public
integer
|
_debug()
|
protected
object
|
$_index
Instance of class Index |
|
protected
integer
|
$_results
Number of results |
|
protected
integer
|
$_pages
Number of result pages |
|
protected
integer
|
$_resultPage
Current result page |
|
protected
integer
|
$_resultPerPage
Results per page to display |
|
protected
array
|
$_replacement
Array of html-tags to emphasize the searchwords |
#
array()
|
protected
array
|
$_rankStructure
Array of article id's with ranking information |
#
array()
|
protected
array
|
$_orderedSearchResult
Array of result-pages with array's of article id's |
#
array()
|
protected
array
|
$_searchResult
Array of article id's with information about cms-types, occurence of keyword/searchword, similarity . |
#
array()
|
$cfg,
$client,
$lang,
$oDB
|