php - Updating indexed documents of Zend Search Lucene indexes -


i have read question creating , updating zend_search_lucene indexes.

but has failed answer problem. this article zend, tells updating document not possible. update effectively, every document have deleted , re indexed.

$removepath = ...; $hits = $index->find('path:' . $removepath); foreach ($hits $hit) {     $index->delete($hit->id); } 

now, not work me. gave index path in $removepath , tried code. didn't work. if use relative particular index such $index->find("title:test"); throws

fatal error:  exception thrown without stack frame in unknown on line 0 

i tried using

  $query = new zend_search_lucene_search_query_term(new zend_search_lucene_index_term('test', 'title'));   $hits = $this -> index->find($query); 

but gave same result.

i not know how debug type of error. , gets debugged, searched items rather documents. so, documents not deleted.

can anyone, tell me doing wrong. how update search indexes?

fatal error: exception thrown without stack frame in unknown on line 0

means have thrown exception exception cannot thrown. occurs when try throw exception in php destructur or php exception handler (destructors , exception handlers not have stack frame)

this error message kind of cryptic because gives no hint error might be.


however know issue: using index static property

so should call commit() on index. prevent lucene throwing exception:

$this->index->commit(); 

to delete documents have interate through index , delete each document.

$index = zend_search_lucene::open('data/index');  $hits = $index->find('id:'.$id);    foreach ($hits $hit) {      $index->delete($hit->id);   } } 

so id or path identify field shoud match parameter record want delete. documents found deleted index.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -