Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • cSearch
  • cSearchBaseAbstract
  • cSearchIndex
  • cSearchResult
  • Overview
  • Package
  • Class
  • Todo
  • Download

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
Extended by cSearchResult
Package: Core\Frontend\Search
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
Methods summary
public
# __construct( array $search_result, integer $result_per_page, cDb $oDB = NULL, boolean $bDebug = false )

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

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

Parameters

$search_result
List of article ids
$result_per_page
Number of items per page
$oDB
Optional db instance
$bDebug
Optional flag to enable debugging

Overrides

cSearchBaseAbstract::__construct()
public
# setOrderedSearchResult( array $ranked_search, integer $result_per_page )

Parameters

$ranked_search
$result_per_page
public string
# getContent( integer $art_id, string $cms_type, integer $id = 0 )

Parameters

$art_id
Id of an article
$cms_type
$id

Returns

string
Content of an article, specified by it's content type
public string
# getSearchContent( integer $art_id, string $cms_type, integer $cms_nr = NULL )

Parameters

$art_id
Id of an article
$cms_type
Content type
$cms_nr

Returns

string

Content of an article in search result, specified by its type

public array
# getSearchResultPage( integer $page_id )

Returns articles in page.

Returns articles in page.

Parameters

$page_id

Returns

array
Articles in page $page_id
public integer
# getNumberOfPages( )

Returns number of result pages

Returns number of result pages

Returns

integer
public integer
# getNumberOfResults( )

Returns number of results

Returns number of results

Returns

integer
public integer
# getSimilarity( integer $art_id )

Parameters

$art_id
Id of an article

Returns

integer
Similarity between searchword and matching word in article
public number
# getOccurrence( integer $art_id )

Parameters

$art_id
Id of an article

Returns

number
of matching searchwords found in article
public
# setReplacement( string $rep1, string $rep2 )

Parameters

$rep1

The opening html-tag to emphasize the searchword e.g. ''

$rep2
The closing html-tag e.g. ''
public integer
# getArtCat( integer $artid )

Parameters

$artid

Returns

integer
Category Id

Todo

Is not job of search, should be outsourced!
Methods inherited from cSearchBaseAbstract
_debug()
Properties summary
protected object $_index

Instance of class Index

Instance of class Index

#
protected integer $_results

Number of results

Number of results

#
protected integer $_pages

Number of result pages

Number of result pages

#
protected integer $_resultPage

Current result page

Current result page

#
protected integer $_resultPerPage

Results per page to display

Results per page to display

#
protected array $_replacement

Array of html-tags to emphasize the searchwords

Array of html-tags to emphasize the searchwords

# array()
protected array $_rankStructure

Array of article id's with ranking information

Array of article id's with ranking information

# array()
protected array $_orderedSearchResult

Array of result-pages with array's of article id's

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 of article id's with information about cms-types, occurence of keyword/searchword, similarity .

# array()
Properties inherited from cSearchBaseAbstract
$cfg, $client, $lang, $oDB
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen