A lot of memory is consumed in luceneapi_facet_counts_get(), sometimes upwards of 20M for larger indexes.

Comments

cpliakas’s picture

Status: Active » Fixed

Fixed in commit #286682.

The problem lies within the Zend Framework's Zend_Search_Lucene_Search_QueryHit class. The following examples illustrate how memory usage differs depending on how you retrieve field data from the Lucene document:


// $hits are the results returned from luceneapi_find()
// NOTE: Home page memory usage: 24285096

foreach ($hits as $hit) {
  $value = $hit->nid;
}
echo memory_get_usage();  // 42294776


// after the same search is executed ...

foreach ($hits as $hit) {
  $value = $index->getDocument($hit->id)->getFieldValue('nid');
}
echo memory_get_usage();  // 25824168

Although method #1 is used in most ZF examples, #2 is obviously much more efficient and also executes a bit more quickly. Search Lucene API now uses method #2 whenever possible, so upgrading to beta4 will show huge performance gains. This issue will be reported upstream to the Zend_Framework.

cpliakas’s picture

Status: Fixed » Closed (fixed)
Issue tags: -6.x-2.0-beta4

Automatically closed -- issue fixed for 2 weeks with no activity.