Description:
Like shown in the attached reproducing example, updating a document in the index will not remove the old (outdated) version from the index, so it will still be found using search terms matching the old contents.
Environment:
Operating System:
PHP Version: (please be specific, like '4.4.3' or '5.1.5')
Database and version:
Browser (and version):
Attachments
test_search.php (1.6 kb) added by Kore Nordmann
Description: Reproducing example
<?php // class Zend_Exception extends Exception {} require '/home/kore/devel/arbit/trunk/src/libraries/Zend/Search/Lucene.php' ; require 'Base/src/base.php' ; spl_autoload_register ( 'ezcBase::autoload' ); file_put_contents ( 'document.xml' , '<?xml version="1.0"?> <document> <field type="id">id</field> <field type="string" boost="2">title</field> <field inResult="false" type="text">body</field> </document>' ); $manager = new ezcSearchXmlManager ( './' ); $session = new ezcSearchSession ( new ezcSearchZendLuceneHandler ( 'tmp/' ), $manager ); class Document implements ezcBasePersistable { public function __construct ( $id = null , $string = null ) { $this -> id = $id ; $this -> string = $string ; } public function getState () { return array( 'id' => $this -> id , 'title' => $this -> string , 'body' => $this -> string , ); } public function setState ( array $state ) { $this -> id = $state [ 'id' ]; $this -> title = $state [ 'title' ]; } } // Remove everything existing $query = $session -> createDeleteQuery ( 'Document' ); $session -> delete ( $query ); // Create new documents $session -> index ( new Document ( 1 , 'Test' ) ); $session -> update ( new Document ( 1 , 'Something else' ) ); $session -> index ( new Document ( 2 , 'Test' ) ); $query = $session -> createFindQuery ( 'Document' ); $queryBuilder = new ezcSearchQueryBuilder (); $queryBuilder -> parseSearchQuery ( $query , 'Test' , array( 'title' , 'body' ) ); $result = $session -> find ( $query ); var_dump ( $result ); ?>
Attachments (1)
Links
No links for this issue.
Links (0)
History
History (5)