views:

144

answers:

2
$index = Zend_Search_Lucene::open("/data/my_index1");

$doc = new Zend_Search_Lucene_Document();

$doc->addField(Zend_Search_Lucene_Field::Text('type','auto'));

$index->addDocument($doc);

$term = new Zend_Search_Lucene_Index_Term('auto*');

$query = new Zend_Search_Lucene_Search_Query_Wildcard($term);

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

foreach ($hits as $hit){

    echo $hit->type;

}

After successful execution of this code, it needs to print auto. But array $hits is empty.

What is the reason behind this?

A: 

You might have to humour me here, but have you tried replacing:

$term = new Zend_Search_Lucene_Index_Term('auto*');

$query = new Zend_Search_Lucene_Search_Query_Wildcard($term);

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

with

$hits  = $index->find('auto*');
devians
A: 

Yes tried, but not working in this case also

siva kiran