This extension allows to access the functionality provided by shellinford (FM-Index).
More information about the shellinford can be found at » https://code.google.com/p/shellinford/
% phpize
% ./configure
% make
% make install
shellinford.ini:
extension=shellinford.so
namespace Shellinford;
$docs = array("apple", "orange", "remon", "application");
$index = new FMindex;
foreach ($docs as $doc) {
$index->push_back($doc);
}
$index->build();
var_dump($index->docsize());
/*
int(4)
*/
var_dump($index->search("app"));
/*
array(2) {
[0]=>
string(5) "apple"
[3]=>
string(11) "application"
}
*/
var_dump($index->search("apple"));
/*
array(1) {
[0]=>
string(5) "apple"
}
*/
var_dump($index->search("apply"));
/*
array(0) {
}
*/