PHP Class TextAnalysis\Engines\InvertedIndexEngine

Author: yooper
显示文件 Open project: yooper/php-text-analysis

Protected Properties

Property Type Description
$dataDir The directory where all the data and metadata files are stored
$invertedIndex TextAnalysis\Indexes\InvertedIndex
$isDirty tracks if the index or metadata has been altered and requires persisting to the database
$metadata array

Public Methods

Method Description
__construct ( $dataDir )
__destruct ( )
addDocument ( TokensDocument $document ) Added a document to the index, default overwrites the existing
getInvertedIndex ( ) : InvertedIndex
getIsDirty ( ) : boolean returns if the index/metadata has been updated since loaded into memory
getMetadata ( ) : array key value array, key is the document id
persist ( ) Persists the data back into the data dir, if it has been changed
query ( string $queryStr ) : array
removeDocument ( TokensDocument $document ) Removes the document from the index

Method Details

__construct() public method

public __construct ( $dataDir )

__destruct() public method

public __destruct ( )

addDocument() public method

Added a document to the index, default overwrites the existing
public addDocument ( TokensDocument $document )
$document TextAnalysis\Documents\TokensDocument

getInvertedIndex() public method

public getInvertedIndex ( ) : InvertedIndex
return TextAnalysis\Indexes\InvertedIndex

getIsDirty() public method

returns if the index/metadata has been updated since loaded into memory
public getIsDirty ( ) : boolean
return boolean

getMetadata() public method

key value array, key is the document id
public getMetadata ( ) : array
return array

persist() public method

Persists the data back into the data dir, if it has been changed
public persist ( )

query() public method

public query ( string $queryStr ) : array
$queryStr string
return array

removeDocument() public method

Removes the document from the index
public removeDocument ( TokensDocument $document )
$document TextAnalysis\Documents\TokensDocument

Property Details

$dataDir protected_oe property

The directory where all the data and metadata files are stored
protected $dataDir

$invertedIndex protected_oe property

protected InvertedIndex,TextAnalysis\Indexes $invertedIndex
return TextAnalysis\Indexes\InvertedIndex

$isDirty protected_oe property

tracks if the index or metadata has been altered and requires persisting to the database
protected $isDirty

$metadata protected_oe property

protected array $metadata
return array