Author: jablko
Date: Tue Aug 25 16:03:46 2009
New Revision: 3073
Log:
Drop final from xfIndexSingle::populate() so we can override in QubitSearch.
Copy xfIndexSingle::populate() to QubitSearch and edit, as a stopgap hack to
populate search index without implementing services, etc. Drop build index
action. Closes issues 813 and 853
Deleted:
trunk/apps/qubit/modules/search/actions/buildIndexAction.class.php
trunk/apps/qubit/modules/search/templates/buildIndexSuccess.php
Modified:
trunk/apps/qubit/lib/SearchIndex.class.php
trunk/lib/search/QubitSearch.class.php
trunk/plugins/sfSearchPlugin/lib/index/xfIndexSingle.class.php
Modified: trunk/apps/qubit/lib/SearchIndex.class.php
==============================================================================
--- trunk/apps/qubit/lib/SearchIndex.class.php Tue Aug 25 13:12:40 2009
(r3072)
+++ trunk/apps/qubit/lib/SearchIndex.class.php Tue Aug 25 16:03:46 2009
(r3073)
@@ -193,37 +193,6 @@
}
}
- /**
- * Build ALL search indexes from scratch
- *
- * @return void
- */
- public static function BuildIndex()
- {
- //build an index for each language
- foreach (self::getEnabledI18nLanguages() as $code => $language)
- {
- setlocale(LC_CTYPE, $code.'.utf-8', $code.'@utf-8');
-
- // Build index (just one per language for now)
- $index =
Zend_Search_Lucene::create(self::getIndexLocation('QubitInformationObject',
$code));
- $index->setMaxMergeDocs(1000);
-
Zend_Search_Lucene_Analysis_Analyzer::setDefault(self::getIndexAnalyzer());
-
- // Information object
- foreach (QubitInformationObject::getByCulture($code) as
$informationObject)
- {
- $doc = self::createIndexDocument($informationObject, $code);
-
- if (null !== $doc)
- {
- $index->addDocument($doc);
- }
- }
-
- }
- }
-
/*********************************************************
Document Creation
*********************************************************/
Modified: trunk/lib/search/QubitSearch.class.php
==============================================================================
--- trunk/lib/search/QubitSearch.class.php Tue Aug 25 13:12:40 2009
(r3072)
+++ trunk/lib/search/QubitSearch.class.php Tue Aug 25 16:03:46 2009
(r3073)
@@ -27,4 +27,24 @@
$this->setEngine(new
xfLuceneEngine(sfConfig::get('sf_data_dir').'/index'));
$this->getEngine()->open();
}
+
+ /**
+ * @see xfIndex
+ */
+ public function populate()
+ {
+ $start = microtime(true);
+ $this->getLogger()->log('Populating index...', $this->getName());
+ $this->getEngine()->erase();
+ $this->getLogger()->log('Index erased.', $this->getName());
+
+ $criteria = new Criteria;
+ foreach (QubitInformationObject::get($criteria) as $informationObject)
+ {
+ SearchIndex::updateTranslatedLanguages($informationObject);
+ $this->getLogger()->log('"'.$informationObject.'" inserted.',
$this->getName());
+ }
+
+ $this->getLogger()->log('Index populated in "'.round(microtime(true) -
$start, 2).'" seconds.', $this->getName());
+ }
}
Modified: trunk/plugins/sfSearchPlugin/lib/index/xfIndexSingle.class.php
==============================================================================
--- trunk/plugins/sfSearchPlugin/lib/index/xfIndexSingle.class.php Tue Aug
25 13:12:40 2009 (r3072)
+++ trunk/plugins/sfSearchPlugin/lib/index/xfIndexSingle.class.php Tue Aug
25 16:03:46 2009 (r3073)
@@ -99,7 +99,7 @@
/**
* @see xfIndex
*/
- final public function populate()
+ public function populate()
{
$this->setup();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---