- Timestamp:
- 09/01/10 11:59:43 (21 months ago)
- Location:
- plugins/apostrophePlugin/trunk
- Files:
-
- 2 modified
-
. (modified) (1 prop)
-
lib/toolkit/aZendSearch.class.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/apostrophePlugin/trunk
- Property svn:mergeinfo changed
/plugins/apostrophePlugin/branches/features/wjohnald (added) merged: 1984,1988,1990,2012,2015,2104-2106
- Property svn:mergeinfo changed
-
plugins/apostrophePlugin/trunk/lib/toolkit/aZendSearch.class.php
r2030 r2107 252 252 // use unStoredFields. For things that need not be indexed at all, like summaries, use unIndexedFields 253 253 254 static public function updateLuceneIndex(Doctrine_Record $object, $ unStoredFields = array(), $culture = null, $unIndexedFields = array(), $storedAndIndexedFields= array())254 static public function updateLuceneIndex(Doctrine_Record $object, $fields = array(), $culture = null, $storedFields = array(), $boostsByField = array()) 255 255 { 256 256 self::deleteFromLuceneIndex($object, $culture); … … 264 264 $doc->addField(Zend_Search_Lucene_Field::Keyword('culture', $culture, 'UTF-8')); 265 265 } 266 // index the UnStoredfields267 foreach ($ unStoredFields as $key => $value)266 // index the search fields 267 foreach ($fields as $key => $value) 268 268 { 269 269 // Ugh: UTF8 Lucene is case sensitive work around this … … 276 276 $value = strtolower($value); 277 277 } 278 $doc->addField(Zend_Search_Lucene_Field::UnStored($key, $value, 'UTF-8')); 278 279 $field = Zend_Search_Lucene_Field::UnStored($key, $value, 'UTF-8'); 280 if (isset($boostsByField[$key])) 281 { 282 $field->boost = $boostsByField[$key]; 283 } 284 $doc->addField($field); 279 285 } 280 286 281 287 // store the data fields (a big performance win over hydrating things with Doctrine) 282 foreach ($ unIndexedFields as $key => $value)288 foreach ($storedFields as $key => $value) 283 289 { 284 290 $doc->addField(Zend_Search_Lucene_Field::UnIndexed($key, $value, 'UTF-8')); 285 }286 287 // index and store the storedAndIndexed fields288 foreach ($storedAndIndexedFields as $key => $value)289 {290 // Ugh: UTF8 Lucene is case sensitive work around this291 if (function_exists('mb_strtolower'))292 {293 $value = mb_strtolower($value);294 }295 else296 {297 $value = strtolower($value);298 }299 $doc->addField(Zend_Search_Lucene_Field::Text($key, $value, 'UTF-8'));300 291 } 301 292 … … 304 295 $index->commit(); 305 296 } 306 297 307 298 // This does a clean job of saving the object in both doctrine and zend 308 299 // without a lot of duplicated code, reducing the potential for

