Skip to content

Commit

Permalink
normalize elastic class management
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandru Dobre committed Nov 7, 2016
1 parent 020f59b commit 7c17ff9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions module/Rubedo/config/services.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
'ElasticContentTypes' => 'Rubedo\\Elastic\\ContentTypes',
'ElasticClickStream' => 'Rubedo\\Elastic\\ClickStream',
'ElasticViewStream' => 'Rubedo\\Elastic\\ViewStream',
'ElasticDataFilters' => 'Rubedo\\Elastic\\DataFilters',
'ElasticDataAggregations' => 'Rubedo\\Elastic\\DataAggregations',
'ElasticDam' => 'Rubedo\\Elastic\\Dam',
'ElasticDamTypes' => 'Rubedo\\Elastic\\DamTypes',
'ElasticUsers' => 'Rubedo\\Elastic\\Users',
Expand Down
9 changes: 5 additions & 4 deletions module/Rubedo/src/Rubedo/Elastic/ClickStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

namespace Rubedo\Elastic;
use Rubedo\Services\Manager;

/**
* Service to handle clickstream indexing and searching.
Expand Down Expand Up @@ -278,7 +279,7 @@ public function getDateHistogramAgg($startDate, $endDate, $interval, $filters =
// Set facet operator for events
SearchContext::setFacetOperator('event','or');
// Build date filter
$filterFactory = new DataFilters();
$filterFactory = Manager::getService("ElasticDataFilters");
$filterFactory->addDateRangeFilter('date', 'date', $startDate, $endDate);
// Build facets filters
foreach (self::$_facets as $key => $field) {
Expand All @@ -296,7 +297,7 @@ public function getDateHistogramAgg($startDate, $endDate, $interval, $filters =
$params['body']['query']['filtered']['filter'] = $globalFilter;
}
// Build facets
$facetFactory = new DataAggregations();
$facetFactory = Manager::getService("ElasticDataAggregations");
foreach (self::$_facets as $key => $field) {
$facetFactory->addAggregation($field, $field);
}
Expand Down Expand Up @@ -364,7 +365,7 @@ public function getGeoAgg($startDate, $endDate, $filters = [])
// Set facet operator for events
SearchContext::setFacetOperator('event','or');
// Build date filter
$filterFactory = new DataFilters();
$filterFactory = Manager::getService("ElasticDataFilters");
$filterFactory->addDateRangeFilter('date', 'date', $startDate, $endDate);
// Build geo filter
$coordinates = [
Expand Down Expand Up @@ -394,7 +395,7 @@ public function getGeoAgg($startDate, $endDate, $filters = [])
$params['body']['query']['filtered']['filter'] = $globalFilter;
}
// Build facets
$facetFactory = new DataAggregations();
$facetFactory = Manager::getService("ElasticDataAggregations");
foreach (self::$_facets as $name => $field) {
$facetFactory->addAggregation($field, $field);
}
Expand Down
5 changes: 3 additions & 2 deletions module/Rubedo/src/Rubedo/Elastic/DataSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

namespace Rubedo\Elastic;

use Rubedo\Services\Manager;
use Zend\Json\Json;

/**
Expand Down Expand Up @@ -194,7 +195,7 @@ public function search(array $params, $option = 'all', $withSummary = true)
$params ['query'] = strip_tags($params ['query']);

// Build filters
$filterFactory = new DataFilters();
$filterFactory =Manager::getService("ElasticDataFilters");

// System filters
$systemFilters = [
Expand Down Expand Up @@ -376,7 +377,7 @@ public function search(array $params, $option = 'all', $withSummary = true)
}

// Build facets
$facetFactory = new DataAggregations();
$facetFactory = Manager::getService("ElasticDataAggregations");

// Add system facets
$systemFacets = [
Expand Down
2 changes: 1 addition & 1 deletion module/Rubedo/src/Rubedo/Elastic/SearchContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static function setFacetedFields($value)
public static function getSeenItems($fingerprint)
{
if (is_null(self::$_seenItems)) {
$viewStream = new ViewStream();
$viewStream = Manager::getService('ElasticViewStream');
self::$_seenItems = $viewStream->getSignificantItems($fingerprint);
}

Expand Down

0 comments on commit 7c17ff9

Please sign in to comment.