blob: d57cc4f999a3e4bad1672c25a1c7f34dab7954c1 [file]
<?php
require_once 'tutorial_autoload.php';
// setup
$handler = new ezcSearchSolrHandler;
$manager = new ezcSearchEmbeddedManager;
$session = new ezcSearchSession( $handler, $manager );
// initialize a pre-configured query
$q = $session->createFindQuery( 'Article' );
// where either body or title contains test but not article
$searchWord = 'test -article';
// run the query builder to search for the $searchWord in body and title
$qb = new ezcSearchQueryBuilder();
$qb->parseSearchQuery( $q, $searchWord, array( 'body', 'title' ) );
// run the query and show titles for found documents, and its score
$r = $session->find( $q );
foreach( $r->documents as $res )
{
echo $res->document->score, ", ", $res->document->title, "\n";
}
?>