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 […]

Getting started with zend framework

I started with PHP in my graduation 7th semester B.E, i liked PHP most because of its simplicity. It takes less than 24 hours to learn and develop web applications using PHP , for complex projects we need frameworks with mvc architecture php mvc , cake php, symfony, code igniter and etc […]

zend framework tutorial | part 9 Zend Auth

Zend Auth is easy to set up and provides a system that secures our site with an easy to use authentication mechanism.
Zend Auth(Zend_Auth) provides an API for authentication and includes concrete authentication adapters for common use case scenarios.
In this Zend Authentication example, i will be discussing only about zend authenticating with a Database […]

zend framework tutorial: Part 8 - Zend Registry

In php programming we always used global or $_GLOBALS to refer to the global variable.
For example consider below -
Db.php
<?php

// connect to mysql server
$mysqlLink = mysql_connect(”mysql_server”, “mysql_user”, “mysql_password”);
?>
index.php
<?php
require_once “Db.php”;
function displayTables()
{
global $mysqlLink;

$sql = “SHOW TABLES”;

//use global variable mysqlLink, and perform query execution

mysql_query($sql, $mysqlLink);

?>
In zend framework, zend registry is an mechanism to using global storage. The registry […]

zend framework tutorial: Part 7 - Accessing form data

When i started to develop a web application using zend framework, i couldn’t get much of articles related to how to access form data, zend framework form handling classes are very good approach in handling form, most of them were still under proposal state.
What i really wanted was to access the form data, which i […]

zend framework tutorial: Part 6 - Zend Debug

Zend debug is used for debugging purpose. The static method Zend_Debug::dump() prints or returns information about an expression, which is much similar of using var_dump.
Syntax is as below -
<?php

// $var argument specifies the expression or variable
// $label argument is a string to be prepended to the output
// $echo argument specifies whether the output […]

zend framework tutorial: Part 5 - Zend Exception

As in other object oriented programming languages, zend framework supports try catch, all exceptions thrown by Zend Framework classes should throw an exception that derives from the base class Zend_Exception.
Example 1:
In this example, code require_once “Zend_Loader.php”; is commented, so error is thrown when we are trying to access Zend_Loader.
<?php
//require_once “Zend_Loader.php”;

try
{
Zend_Loader::loadClass(’Zend_Session’);
}
catch (Zend_Exception $e) {
echo “Error message: […]

« Previous Entries