Skip to content

Commit

Permalink
API QueuedJob support for Solr_Reindex
Browse files Browse the repository at this point in the history
API Incremental clear and re-index of records rather than clearing all records from SolrIndex up front
  • Loading branch information
Damian Mooyman committed Jul 28, 2015
1 parent 259bd03 commit 1683f77
Show file tree
Hide file tree
Showing 22 changed files with 2,103 additions and 198 deletions.
2 changes: 2 additions & 0 deletions _config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

global $databaseConfig;
if (isset($databaseConfig['type'])) SearchUpdater::bind_manipulation_capture();

Deprecation::notification_version('1.0.0', 'fulltextsearch');
8 changes: 8 additions & 0 deletions _config/processor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Name: defaultprocessor
Injector:
SearchUpdateProcessor:
class: SearchUpdateImmediateProcessor
SolrReindexHandler:
class: SolrReindexImmediateHandler
SearchLogFactory:
class: 'MonologFactory'
---
Name: messagequeueprocessor
Only:
Expand All @@ -14,6 +18,8 @@ Except:
Injector:
SearchUpdateProcessor:
class: SearchUpdateMessageQueueProcessor
SolrReindexHandler:
class: SolrReindexMessageHandler
---
Name: queuedjobprocessor
Only:
Expand All @@ -24,3 +30,5 @@ Except:
Injector:
SearchUpdateProcessor:
class: SearchUpdateQueuedJobProcessor
SolrReindexHandler:
class: SolrReindexQueuedHandler
8 changes: 8 additions & 0 deletions code/search/SearchVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ abstract function reindexStates();
*/
abstract function activateState($state);

/**
* Apply this variant to a search query
*
* @param SearchQuery $query
* @param SearchIndex $index
*/
abstract public function alterQuery($query, $index);

/*** OVERRIDES end here*/

/** Holds a cache of all variants */
Expand Down
2 changes: 1 addition & 1 deletion code/search/SearchVariantSiteTreeSubsitesPolyhome.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function alterDefinition($base, $index) {
);
}

function alterQuery($query, $index) {
public function alterQuery($query, $index) {
$subsite = Subsite::currentSubsiteID();
$query->filter('_subsite', array($subsite, SearchQuery::$missing));
}
Expand Down
2 changes: 1 addition & 1 deletion code/search/SearchVariantVersioned.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function alterDefinition($base, $index) {
);
}

function alterQuery($query) {
public function alterQuery($query, $index) {
$stage = Versioned::current_stage();
$query->filter('_versionedstage', array($stage, SearchQuery::$missing));
}
Expand Down
Loading

0 comments on commit 1683f77

Please sign in to comment.