mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Merge branch 'feature/SEARCH-1738_ShardingMethods' into 'master'
Feature/search 1738 sharding methods See merge request search_discovery/insightengine!113
This commit is contained in:
+1
-5
@@ -21,8 +21,6 @@ package org.alfresco.solr.tracker;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.solr.client.Acl;
|
||||
@@ -112,9 +110,7 @@ public class DBIDRangeRouter implements DocRouter
|
||||
@Override
|
||||
public Map<String, String> getProperties(QName shardProperty)
|
||||
{
|
||||
return Stream.of(new String[][] {
|
||||
{ DocRouterFactory.SHARD_RANGE_KEY, startRange + "-" + expandableRange },
|
||||
}).collect(Collectors.toMap(data -> data[0], data -> data[1]));
|
||||
return Map.of(DocRouterFactory.SHARD_RANGE_KEY, startRange + "-" + expandableRange);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-6
@@ -26,11 +26,10 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* The date-based sharding assigns dates sequentially through shards based on the month.
|
||||
@@ -124,10 +123,12 @@ public class DateMonthRouter implements DocRouter
|
||||
@Override
|
||||
public Map<String, String> getProperties(QName shardProperty)
|
||||
{
|
||||
return Stream.of(new String[][] {
|
||||
{ DocRouterFactory.SHARD_KEY_KEY, shardProperty.getPrefixString() },
|
||||
{ DocRouterFactory.SHARD_DATE_GROUPING_KEY, String.valueOf(grouping) },
|
||||
}).collect(Collectors.toMap(data -> data[0], data -> data[1]));
|
||||
|
||||
return (shardProperty == null ?
|
||||
Collections.emptyMap() :
|
||||
Map.of(DocRouterFactory.SHARD_KEY_KEY, shardProperty.getPrefixString(),
|
||||
DocRouterFactory.SHARD_DATE_GROUPING_KEY, String.valueOf(grouping)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-5
@@ -18,9 +18,8 @@
|
||||
*/
|
||||
package org.alfresco.solr.tracker;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.solr.client.Acl;
|
||||
@@ -81,9 +80,9 @@ public class ExplicitShardIdWithDynamicPropertyRouter extends ComposableDocRoute
|
||||
@Override
|
||||
public Map<String, String> getProperties(QName shardProperty)
|
||||
{
|
||||
return Stream.of(new String[][] {
|
||||
{ DocRouterFactory.SHARD_KEY_KEY, shardProperty.getPrefixString() },
|
||||
}).collect(Collectors.toMap(data -> data[0], data -> data[1]));
|
||||
return (shardProperty == null ?
|
||||
Collections.emptyMap() :
|
||||
Map.of(DocRouterFactory.SHARD_KEY_KEY, shardProperty.getPrefixString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-6
@@ -26,11 +26,10 @@ import org.apache.solr.common.util.Hash;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Routes based on a text property field.
|
||||
@@ -129,10 +128,10 @@ public class PropertyRouter implements DocRouter
|
||||
@Override
|
||||
public Map<String, String> getProperties(QName shardProperty)
|
||||
{
|
||||
return Stream.of(new String[][] {
|
||||
{ DocRouterFactory.SHARD_KEY_KEY, shardProperty.getPrefixString() },
|
||||
{ DocRouterFactory.SHARD_REGEX_KEY, propertyRegEx },
|
||||
}).collect(Collectors.toMap(data -> data[0], data -> data[1]));
|
||||
return (shardProperty == null ?
|
||||
Collections.emptyMap() :
|
||||
Map.of(DocRouterFactory.SHARD_KEY_KEY, shardProperty.getPrefixString(),
|
||||
DocRouterFactory.SHARD_REGEX_KEY, propertyRegEx));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user