Reputation: 1716
I have indexed a site using Nutch and now I am searching the index using the Zend Lucene library.
I've actually pulled the Zend libraries into Codeigniter but it is all Zend doing the work.
I can display the title, score and url fine but I can't find the name of the field to display the content from the page.
So far I have the following code
$index = new Zend_Search_Lucene('C:\nutch\nutch-0.9\my-search\index');
$query = $this->input->post('searchQuery');
$hits = $index->find($query);
echo "<p>Index contains " . $index->count() . " documents.</p>";
echo "<p>Search for '" . $query . "' returned " . count($hits) . " hits</p>";
foreach ($hits as $hit)
{
echo "<h4>" . $hit->title . "</h4>";
echo "<p><b>Score:</b> " . sprintf('%.2f', $hit->score) . "</p>";
echo "<p><b>Url:</b> " ."<a href='" . $hit->url . "'>" . $hit->url. "</a></p>";
}
Can anyone help out with the name of the field to display the content or a content summary?
Thanks
Upvotes: 2
Views: 569
Reputation: 7854
I don't know the nutch index format, but whenever I need to check a lucene index I use Luke - Lucene Index Toolbox
It allows you to open an index directory, browse fields and run queries. Very helpful if you're using an unfamiliar index.
Upvotes: 2