Skip to content

Instantly share code, notes, and snippets.

@dmj
Created September 26, 2012 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmj/3787317 to your computer and use it in GitHub Desktop.
Save dmj/3787317 to your computer and use it in GitHub Desktop.
Test vf2 search subsystem @ v0.6
<?php
require_once(realpath(__DIR__ . '/vendor/autoload.php'));
$sm = new \Zend\ServiceManager\ServiceManager(new \Zend\Mvc\Service\ServiceManagerConfig(array()));
$sm->setService(
'ApplicationConfig',
array(
'modules' => array('VuFindSearch'),
'module_listener_options' => array(
'module_paths' => array(
'VuFindSearch' => realpath(__DIR__),
)
)
)
);
$sm->get('ModuleManager')->loadModules();
$q = new VuFindSearch\Query\Query('');
$p = new VuFindSearch\Query\Params();
$result = $sm->get('VuFind\Search')->search(array('solr', 'biblio'), $q, $p);
foreach ($result as $position => $record) {
printf("%2d. %.80s%s\n", 1 + $position, $record->title, strlen($record->title) > 80 ? '…' : '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment