Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe Indexer

Fonctions membres publiques

 __construct (DatabaseInterface $db=null)
 
 index ($item, $format='html')
 
 remove ($linkId, $removeTaxonomies=true)
 
 optimize ()
 

Fonctions membres publiques statiques

static getState ()
 
static setState ($data)
 
static resetState ()
 

Champs de données

const TITLE_CONTEXT = 1
 
const TEXT_CONTEXT = 2
 
const META_CONTEXT = 3
 
const PATH_CONTEXT = 4
 
const MISC_CONTEXT = 5
 

Attributs publics statiques

static $state
 
static $profiler
 

Fonctions membres protégées

 tokenizeToDb ($input, $context, $lang, $format, $count=0)
 
 toggleTables ($memory)
 

Fonctions membres protégées statiques

static getSignature ($item)
 

Attributs protégés

 $db
 
 $addTokensToDbQueryTemplate
 

Fonctions membres privées

 tokenizeToDbShort ($input, $context, $lang, $format, $count)
 

Description détaillée

Main indexer class for the Finder indexer package.

The indexer class provides the core functionality of the Finder search engine. It is responsible for adding and updating the content links table; extracting and scoring tokens; and maintaining all referential information for the content.

Note: All exceptions thrown from within this class should be caught by the controller.

Depuis
2.5

Documentation des constructeurs et destructeur

◆ __construct()

__construct ( DatabaseInterface  $db = null)

Indexer constructor.

Paramètres
DatabaseInterface$dbThe database
Depuis
3.8.0

Références $db, class, Factory\getContainer(), et null.

Documentation des fonctions membres

◆ getSignature()

static getSignature (   $item)
staticprotected

Method to get a content item's signature.

Paramètres
object$itemThe content item to index.
Renvoie
string The content item's signature.
Depuis
2.5

Références $config, $item, $state, et Joomla\CMS\MVC\Model\getState().

◆ getState()

static getState ( )
static

Method to get the indexer state.

Renvoie
object The indexer state object.
Depuis
2.5

Try to calculate the heapsize for the memory table for indexing. If this fails, we fall back on a reasonable small size. We want to prevent the system to fail and block saving content.

In tests, the size of a row seems to have been around 720 bytes. We take 800 to be on the safe side.

Références $data, $db, $state, Factory\getApplication(), Factory\getDate(), Factory\getDbo(), Profiler\getInstance(), ComponentHelper\getParams(), Factory\getSession(), et null.

Référencé par IndexerController\batch(), FinderIndexCommand\index(), IndexerController\optimize(), et IndexerController\start().

◆ index()

index (   $item,
  $format = 'html' 
)

Method to index a content item.

Paramètres
Result$itemThe content item to index.
string$formatThe format of the content. [optional]
Renvoie
integer The ID of the record in the links table.
Depuis
2.5
Exceptions

Références $context, $count, $db, $format, $item, $link, $query, $state, Taxonomy\addMap(), Taxonomy\addNestedNode(), Taxonomy\addNode(), Factory\getApplication(), Factory\getDate(), Joomla\CMS\MVC\Model\getState(), PluginHelper\importPlugin(), ParameterType\INTEGER, ParameterType\LARGE_OBJECT, null, Helper\parse(), Taxonomy\removeMaps(), File\stripExt(), et StringHelper\substr().

◆ optimize()

optimize ( )

Method to optimize the index. We use this method to remove unused terms and any other optimizations that might be necessary.

Renvoie
boolean True on success.
Depuis
2.5
Exceptions
Exceptionon database error.

Références $db, $query, Taxonomy\removeOrphanMaps(), et Taxonomy\removeOrphanNodes().

◆ remove()

remove (   $linkId,
  $removeTaxonomies = true 
)

Method to remove a link from the index.

Paramètres
integer$linkIdThe id of the link.
bool$removeTaxonomiesRemove empty taxonomies
Renvoie
boolean True on success.
Depuis
2.5
Exceptions
Exceptionon database error.

Références $db, $query, Factory\getApplication(), PluginHelper\importPlugin(), ParameterType\INTEGER, Taxonomy\removeMaps(), et Taxonomy\removeOrphanNodes().

◆ resetState()

static resetState ( )
static

Method to reset the indexer state.

Renvoie
void
Depuis
2.5

Références $state, Factory\getSession(), et null.

Référencé par FinderIndexCommand\index(), et IndexerController\start().

◆ setState()

static setState (   $data)
static

Method to set the indexer state.

Paramètres
CMSObject$dataA new indexer state object.
Renvoie
boolean True on success, false on failure.
Depuis
2.5

Références $data, $state, et Factory\getSession().

Référencé par IndexerController\batch().

◆ toggleTables()

toggleTables (   $memory)
protected

Method to switch the token tables from Memory tables to Disk tables when they are close to running out of memory. Since this is not supported/implemented in all DB-drivers, the default is a stub method, which simply returns true.

Paramètres
boolean$memoryFlag to control how they should be toggled.
Renvoie
boolean True on success.
Depuis
2.5
Exceptions
Exceptionon database error.

Références $db, $state, et elseif.

◆ tokenizeToDb()

tokenizeToDb (   $input,
  $context,
  $lang,
  $format,
  $count = 0 
)
protected

Method to parse input, tokenize it, and then add it to the database.

Paramètres
mixed$inputString or resource to use as input. A resource input will automatically be chunked to conserve memory. Strings will be chunked if longer than 2K in size.
integer$contextThe context of the input. See context constants.
string$langThe language of the input.
string$formatThe format of the input.
integer$countNumber of words indexed so far.
Renvoie
integer The number of tokens extracted from the input.
Depuis
2.5

Références $buffer, $context, $count, $format, $input, $lang, null, et StringHelper\trim().

◆ tokenizeToDbShort()

tokenizeToDbShort (   $input,
  $context,
  $lang,
  $format,
  $count 
)
private

Method to parse input, tokenise it, then add the tokens to the database.

Paramètres
string$inputString to parse, tokenise and add to database.
integer$contextThe context of the input. See context constants.
string$langThe language of the input.
string$formatThe format of the input.
integer$countThe number of tokens processed so far.
Renvoie
integer Cumulative number of tokens extracted from the input so far.
Depuis
3.7.0

Références $context, $count, $format, $input, $lang, $params, $query, $state, ComponentHelper\getParams(), null, Helper\parse(), et Helper\tokenize().

Documentation des champs

◆ $addTokensToDbQueryTemplate

$addTokensToDbQueryTemplate
protected

◆ $db

$db
protected

◆ $profiler

$profiler
static

◆ $state

$state
static

◆ META_CONTEXT

const META_CONTEXT = 3

◆ MISC_CONTEXT

const MISC_CONTEXT = 5

◆ PATH_CONTEXT

const PATH_CONTEXT = 4

◆ TEXT_CONTEXT

const TEXT_CONTEXT = 2

◆ TITLE_CONTEXT

const TITLE_CONTEXT = 1

La documentation de cette classe a été générée à partir du fichier suivant :