Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-23-2008, 06:52 PM
Junior Member
 
Join Date: Mar 2008
Posts: 8
Default no results

Code:
function findAction()
	{
$index = Zend_Search_Lucene::open('/var/www/firmy/data/indexes/index');

	if ($this->_request->isPost()) {
	Zend_Loader::loadClass('Zend_Filter_StripTags');
	$filter=new Zend_Filter_StripTags();
	$string=trim($filter->filter($this->_request->getPost('string')));
	$what=trim($filter->filter($this->_request->getPost('typ')));

$index_path="/var/www/firmy/data/indexes/index";
$index = Zend_Search_Lucene::open($index_path);
$name = $string;
$term = new Zend_Search_Lucene_Index_Term($name, $what);
$name = new Zend_Search_Lucene_Search_Query_Term($term);
echo $name;
$this->view->results = $index->find($name);
}
}
indexer.php :

Quote:
<?php

// Add your vendor directory to the includepath. ZF needs this.
//ini_set('include_path', ini_get('include_path') . ':' . dirname(__FILE__) . '/vendors');

// Require the Lucene Class
require_once('Zend/Search/Lucene.php');

// Establish your connection to the database
mysql_connect('localhost', 'root', '');
mysql_select_db('zend');

// Create a new index. This folder has to be readable by the httpd user
// I will use the cache directory to store the index data
$indexPath = dirname(__FILE__) . '/firmy/data/indexes/index';
$index = new Zend_Search_Lucene($indexPath, true);

// Lets get some records to add to the index
$documents_rs = mysql_query('SELECT * FROM posts');
while($document = mysql_fetch_object($documents_rs)) {
// Create a new searchable document instance
$doc = new Zend_Search_Lucene_Document();

// Add some information
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('id' , $document->id));
$doc->addField(Zend_Search_Lucene_Field::Text('name', $document->name));
$doc->addField(Zend_Search_Lucene_Field::Text('post', $document->post));
$doc->addField(Zend_Search_Lucene_Field::Keyword('id_no ', $document->id_no));
$doc->addField(Zend_Search_Lucene_Field::Text('activity ', $document->activity));
//$doc->addField(Zend_Search_Lucene_Field::Text('document _description', $document->description));

// Add the document to the index
$index->addDocument($doc);
}

// Commit the index
$index->commit();
echo 'OK';
?>

Last edited by garfield : 03-23-2008 at 07:01 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-24-2008, 03:10 PM
xentek's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 112
Default

And the question is?
__________________
- xentek
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-26-2008, 12:52 PM
Junior Member
 
Join Date: Mar 2008
Posts: 8
Default the question is

why do i get no results? it seems it had indexed my table allright, it does find something but usually not what i want. i will do more research, please help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:13 PM.