depage-xmldb v2.3.1
XML documents in a relational database
Loading...
Searching...
No Matches
Indexer Class Reference

Detailed Description

Definition at line 24 of file Indexer.php.

Public Member Functions

 __construct (XmlDb $xmlDb)
 query (string $xpath, ?int $docId=null)
 resolves an xpath query to a list of IndexerResult objects

Protected Member Functions

 splitAttribute (string $xpath)
 detects whether the xpath targets an attribute and separates the attribute reference from the element xpath.

Protected Attributes

XmlDb $xmlDb

Constructor & Destructor Documentation

◆ __construct()

__construct ( XmlDb $xmlDb)
Parameters
XmlDb$xmlDbthe xmlDb instance to resolve against

Definition at line 31 of file Indexer.php.

Member Function Documentation

◆ query()

query ( string $xpath,
?int $docId = null )

the values of all matched nodes are fetched with a fixed number of queries (one for the node ids, one for the attributes/document ids and, for element targets, one for the text content of the subtrees), independent of the number of matches

Parameters
string$xpathxpath to target node or attribute
int$docIdoptional id of document to restrict to
Returns
IndexerResult[] array of resolved values, empty when no node matches or the targeted attribute is absent

Definition at line 50 of file Indexer.php.

◆ splitAttribute()

splitAttribute ( string $xpath)
protected

The xpath targets an attribute when its last path step is an attribute reference (".../@name"), optionally followed by a predicate. Attribute references inside a predicate ("...[@name]") are not mistaken for a targeted attribute, because the trailing reference must be preceded by a '/' and terminate the path.

Parameters
string$xpathxpath to analyze
Returns
array [string $elementXpath, string|null $attrName]

Definition at line 114 of file Indexer.php.

Field Documentation

◆ $xmlDb

XmlDb $xmlDb
protected

Definition at line 26 of file Indexer.php.


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