Ganesh H S

Thoughts on open source technologies, search engine optimization, website security

Zend Lucene Search - part4 - Search Results Highlighting

Zend_Search_Lucene_Search_Query::highlightMatches() method allows the developer to highlight HTML document terms in the context of a search query.
In the previous article Zend Lucene Search - part3 - retrieving the indexed data i talked about retrieving the search results. When we search, highlighting […]

Zend Lucene Search - part3 - retrieving the indexed data

Once the index is created, we are ready use zend lucene search to search the website. In the following example, php is the search keyword used to fetch the relevant search results in the already indexed data.

<?php

require_once ‘Zend/Search/Lucene.php’;$query = “php”;

$index = Zend_Search_Lucene::open(”/var/www/lucene-data/blog-index”);

$results = $index->find($query);

echo “Index contains “.$index->count().” documents.\n\n”;

if($index->count())

{

$count = 0;

foreach ($results as $result)

{

$data[$count][”article_url”] […]

Zend Lucene Search - part2 - Real time indexing

For creating the index from the existing data, we need to create the index. Isn’t it a better idea to index each data when its created, to index the real time data we need to open the index which was created earlier, rest of the other things remains same as discussed in the Zend lucene […]

Zend Lucene Search - part1 - creating index

In this article i will be discussing about creating index using zend lucene search .
Conventionally most of the site search are powered by database driven.
Lets consider my blog site, if anyone comes to my site and wants to search for any keyword, if i have to give search results i may have to look into […]