Start by making sure that you have installed the following:
- curl (Make sure that you have added curl to the path environment variable)
- composer
Make sure that openssl has been enabled in the php.ini used by the command line. (For those using wamp on windows, there are two php ini files. One for the apache and another one for the command line.)
Fire up the command line and use the CD command to go the directory where you have unzipped zend search and run the following two commands
curl -s h**ps://getcomposer.org/installer | php
php composer.phar install
create a php file in the same directory and include .vendor/autoload.php
Create an create an autoload function to load the different libraries. For the moment I have wrote something simple as the following:
function autoload($classname) {
$path = __DIR . DS . "library" .DS . $classname . ".php";if(file_exists($path)) { require_once($path);
} }
This should load the different classes providing that you know their namespace. This is basic autoloader and should not be used.
I have been using the following guide however it's outdated as the name of the classes have been modified to something like the following:
$indexPath = 'C:\wamp\www\storage'; $index = ZendSearch\Lucene\Lucene::create($indexPath);
$doc = new ZendSearch\Lucene\Document();
$doc->addField(ZendSearch\Lucene\Document\Field::UnIndexed('url', $docUrl)); $doc->addField(ZendSearch\Lucene\Document\Field::UnIndexed('created', $docCreated)); $doc->addField(ZendSearch\Lucene\Document\Field::UnIndexed('teaser', $docTeaser)); $doc->addField(ZendSearch\Lucene\Document\Field::Text('title', $docTitle)); $doc->addField(ZendSearch\Lucene\Document\Field::Text('author', $docAuthor)); $doc->addField(ZendSearch\Lucene\Document\Field::UnStored('contents', $docBody));
$index->addDocument($doc); $index->commit();