I'm currently experiencing the same issue here. Using Luke (http://www.getopt.org/luke/
) I've confirmed that my field and its values is actually stored in
the index. The weird things is that - using the exact same index - the
application used to work just fine, but it started throwing these
exceptions over-night. In my case this happened in an old project on a
shared host where - according to the hosting provider - nothing was
changed. Alex, any ideas as to what might be going on here?
Cheers,
- Jurriën
On Feb 25, 2009, at 07:51 , Jean L wrote:
Here it is. Greatly appreciate your kind help.
---------------------------------
<?php
require_once 'Zend/Search/Lucene.php';
require_once 'Zend/Search/Lucene/Document/Html.php';
if(is_dir("/local/clien/www/html_index/an_index") == 1){
$index
=Zend_Search_Lucene::open('/local/clien/www/html_index/an_index');
echo "opening index...<br>";
}
else {
//Create a new index
$index
=Zend_Search_Lucene::create('/local/clien/www/html_index/an_index');
echo "creating index...<br>";
}
$filename="AFile";
$doc = Zend_Search_Lucene_Document_Html::loadHTMLFile($filename);
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('url',
$filename));
$index->addDocument($doc);
?>
----------------------
Serkys wrote:
Show me full code of creating index, please
Jean L wrote:
Thanks for the reply.
I change it to "UnIndexed" field, however, the same error message is
still there....
Jean
Serkys wrote:
I think, URL better stored in "UnIndexed" fields.
Jean L wrote:
Hi all,
I'm currently having problem with indexing html files using
Zend_Search_Lucene. Any help is appreciated.
So far I can create my index properly. I add text field "url"
to store
my file name and add that to my doc.
Here's the problem: when I want to show the file name, an error
message occurs and it reads :
PHP Fatal error:Uncaught exception 'Zend_Search_Lucene'with
message
'Field name "url" not found in document.' in
local/zend/1.7.3/app/library/Zend/Search/Lucene/Document.php:
102\nStack
trace:\n#0
/local/zend/1.7.3/app/library/Zend/Search/Lucene/Document(116):
Zend_Search_Lucene_Document->getField('url')#1....(continued)
The code is following:
---------------------------------
$filename="aFile";
$doc =
Zend_Search_Lucene_Document_Html::loadHTMLFile($filename);
$doc->addField(Zend_Search_Lucene_Field::Text('url',
$filename));
$index->addDocument($doc);
......
---------------------------------
$query=Zend_Search_Lucene_Search_QueryParser::parse($queryStr);
$hits = $index->find($query);
foreach ($hits as $hit) {
echo $hit->url."<br>";
echo $hit->title."<br>";
.....
Any help is appreciated.
Jean
--
View this message in context:
http://www.nabble.com/Zend_Search_Lucene-field-not-found-tp22153855p22188081.html
Sent from the Zend Framework mailing list archive at Nabble.com.