Skip to content

Commit

Permalink
Merge branch 'opendata-fix' of github.com:open4good/open4goods into o…
Browse files Browse the repository at this point in the history
…pendata-fix
  • Loading branch information
scezen committed Oct 17, 2024
2 parents 41325c2 + 038d6f2 commit 0614a74
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,19 @@ public Stream<Product> exportAll(String vertical) {

/**
* Export all aggregated data, corresponding to the given Barcodes
*
*
* @return
*/
public Stream<Product> exportAll(BarcodeType... barcodeTypes) {

Criteria criteria = new Criteria("gtinInfos.upcType").in((Object[]) barcodeTypes);
CriteriaQuery query = new CriteriaQuery(criteria);

return elasticsearchOperations.searchForStream(query, Product.class, current_index).stream()
.map(SearchHit::getContent);
}


public Stream<Product> searchInValidPrices(String query, final String indexName, int from, int to) {

Criteria c = new Criteria().expression(query).and(getRecentPriceQuery());
Expand Down Expand Up @@ -400,15 +400,15 @@ public void addToFullindexationQueue(Collection<Product> data) {
public void addToPartialIndexationQueue(Collection<ProductPartialUpdateHolder> data) {

logger.info("Queuing {} products", data.size());

data.forEach(e -> {

try {
partialProductQueue.put(e) ;
} catch (Exception e1) {
logger.error("!!!! exception, cannot enqueue product {}",e);
}

});
}

Expand Down Expand Up @@ -585,19 +585,19 @@ public Long countMainIndexHavingRecentPrices() {
return elasticsearchOperations.count(query, current_index);
}

@Cacheable(keyGenerator = CacheConstants.KEY_GENERATOR, cacheNames = CacheConstants.ONE_HOUR_LOCAL_CACHE_NAME)
public Long countMainIndexHavingRecentUpdate() {
CriteriaQuery query = new CriteriaQuery(getRecentPriceQuery());
return elasticsearchOperations.count(query, current_index);
}

@Cacheable(cacheNames = CacheConstants.ONE_DAY_LOCAL_CACHE_NAME)
public long countItemsByBarcodeType(BarcodeType... barcodeTypes) {
Criteria criteria = new Criteria("gtinInfos.upcType").in((Object[]) barcodeTypes);
CriteriaQuery query = new CriteriaQuery(criteria);
return elasticsearchOperations.count(query, current_index);
}


@Cacheable(keyGenerator = CacheConstants.KEY_GENERATOR, cacheNames = CacheConstants.ONE_HOUR_LOCAL_CACHE_NAME)
public Long countMainIndexHavingRecentUpdate() {
CriteriaQuery query = new CriteriaQuery(getRecentPriceQuery());
return elasticsearchOperations.count(query, current_index);
}

@Cacheable(keyGenerator = CacheConstants.KEY_GENERATOR, cacheNames = CacheConstants.ONE_HOUR_LOCAL_CACHE_NAME)
public Map<Integer, Long> byTaxonomy() {

Expand Down

0 comments on commit 0614a74

Please sign in to comment.