mirror of https://github.com/apache/lucene.git
SOLR-14543: Fix or suppress warnings in apache/solr/search
This commit is contained in:
parent
f404a38fa6
commit
04ba04c29d
|
@ -306,6 +306,8 @@ Other Changes
|
||||||
|
|
||||||
* SOLR-14542: Fix or suppress warnings in solr/handler/dataimport (Erick Erickson)
|
* SOLR-14542: Fix or suppress warnings in solr/handler/dataimport (Erick Erickson)
|
||||||
|
|
||||||
|
* SOLR-14543: Fix or suppress warnings in apache/solr/search (Erick Erickson)
|
||||||
|
|
||||||
================== 8.5.2 ==================
|
================== 8.5.2 ==================
|
||||||
|
|
||||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||||
|
|
|
@ -56,7 +56,7 @@ public abstract class AbstractReRankQuery extends RankQuery {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public TopDocsCollector getTopDocsCollector(int len, QueryCommand cmd, IndexSearcher searcher) throws IOException {
|
public TopDocsCollector getTopDocsCollector(int len, QueryCommand cmd, IndexSearcher searcher) throws IOException {
|
||||||
if(this.boostedPriority == null) {
|
if(this.boostedPriority == null) {
|
||||||
SolrRequestInfo info = SolrRequestInfo.getRequestInfo();
|
SolrRequestInfo info = SolrRequestInfo.getRequestInfo();
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class CacheConfig implements MapSerializable{
|
||||||
|
|
||||||
private String nodeName;
|
private String nodeName;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private Class<? extends SolrCache> clazz;
|
private Class<? extends SolrCache> clazz;
|
||||||
private Map<String,String> args;
|
private Map<String,String> args;
|
||||||
private CacheRegenerator regenerator;
|
private CacheRegenerator regenerator;
|
||||||
|
@ -61,6 +62,7 @@ public class CacheConfig implements MapSerializable{
|
||||||
|
|
||||||
public CacheConfig() {}
|
public CacheConfig() {}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public CacheConfig(Class<? extends SolrCache> clazz, Map<String,String> args, CacheRegenerator regenerator) {
|
public CacheConfig(Class<? extends SolrCache> clazz, Map<String,String> args, CacheRegenerator regenerator) {
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
this.args = args;
|
this.args = args;
|
||||||
|
@ -91,6 +93,7 @@ public class CacheConfig implements MapSerializable{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public static CacheConfig getConfig(SolrConfig solrConfig, String xpath) {
|
public static CacheConfig getConfig(SolrConfig solrConfig, String xpath) {
|
||||||
Node node = solrConfig.getNode(xpath, false);
|
Node node = solrConfig.getNode(xpath, false);
|
||||||
if(node == null || !"true".equals(DOMUtil.getAttrOrDefault(node, "enabled", "true"))) {
|
if(node == null || !"true".equals(DOMUtil.getAttrOrDefault(node, "enabled", "true"))) {
|
||||||
|
@ -103,9 +106,11 @@ public class CacheConfig implements MapSerializable{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public static CacheConfig getConfig(SolrConfig solrConfig, String nodeName, Map<String,String> attrs, String xpath) {
|
public static CacheConfig getConfig(SolrConfig solrConfig, String nodeName, Map<String,String> attrs, String xpath) {
|
||||||
CacheConfig config = new CacheConfig();
|
CacheConfig config = new CacheConfig();
|
||||||
config.nodeName = nodeName;
|
config.nodeName = nodeName;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map attrsCopy = new LinkedHashMap<>(attrs.size());
|
Map attrsCopy = new LinkedHashMap<>(attrs.size());
|
||||||
for (Map.Entry<String, String> e : attrs.entrySet()) {
|
for (Map.Entry<String, String> e : attrs.entrySet()) {
|
||||||
attrsCopy.put(e.getKey(), String.valueOf(e.getValue()));
|
attrsCopy.put(e.getKey(), String.valueOf(e.getValue()));
|
||||||
|
@ -138,6 +143,7 @@ public class CacheConfig implements MapSerializable{
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public SolrCache newInstance() {
|
public SolrCache newInstance() {
|
||||||
try {
|
try {
|
||||||
SolrCache cache = clazz.getConstructor().newInstance();
|
SolrCache cache = clazz.getConstructor().newInstance();
|
||||||
|
@ -152,7 +158,9 @@ public class CacheConfig implements MapSerializable{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public Map<String, Object> toMap(Map<String, Object> map) {
|
public Map<String, Object> toMap(Map<String, Object> map) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map result = Collections.unmodifiableMap(args);
|
Map result = Collections.unmodifiableMap(args);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,5 +38,7 @@ public interface CacheRegenerator {
|
||||||
* @param oldVal the old value of the cache item
|
* @param oldVal the old value of the cache item
|
||||||
* @return true to continue with autowarming, false to stop
|
* @return true to continue with autowarming, false to stop
|
||||||
*/
|
*/
|
||||||
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache, SolrCache oldCache, Object oldKey, Object oldVal) throws IOException;
|
public boolean regenerateItem(SolrIndexSearcher newSearcher,
|
||||||
|
@SuppressWarnings({"rawtypes"})SolrCache newCache,
|
||||||
|
@SuppressWarnings({"rawtypes"})SolrCache oldCache, Object oldKey, Object oldVal) throws IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,9 @@ public class CaffeineCache<K, V> extends SolrCacheBase implements SolrCache<K, V
|
||||||
return persistence;
|
return persistence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
private Cache<K, V> buildCache(Cache<K, V> prev) {
|
private Cache<K, V> buildCache(Cache<K, V> prev) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Caffeine builder = Caffeine.newBuilder()
|
Caffeine builder = Caffeine.newBuilder()
|
||||||
.initialCapacity(initialSize)
|
.initialCapacity(initialSize)
|
||||||
.executor(executor)
|
.executor(executor)
|
||||||
|
|
|
@ -366,6 +366,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public DelegatingCollector getFilterCollector(IndexSearcher indexSearcher) {
|
public DelegatingCollector getFilterCollector(IndexSearcher indexSearcher) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -376,6 +377,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
|
||||||
//because the QueryElevationComponent runs after the Queries are constructed.
|
//because the QueryElevationComponent runs after the Queries are constructed.
|
||||||
|
|
||||||
IntIntHashMap boostDocsMap = null;
|
IntIntHashMap boostDocsMap = null;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map context = null;
|
Map context = null;
|
||||||
SolrRequestInfo info = SolrRequestInfo.getRequestInfo();
|
SolrRequestInfo info = SolrRequestInfo.getRequestInfo();
|
||||||
if(info != null) {
|
if(info != null) {
|
||||||
|
@ -1451,8 +1453,9 @@ public class CollapsingQParserPlugin extends QParserPlugin {
|
||||||
* If it is, then "this" will be added to the readerContext
|
* If it is, then "this" will be added to the readerContext
|
||||||
* using the "CSCORE" key, and true will be returned. If not returns false.
|
* using the "CSCORE" key, and true will be returned. If not returns false.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public boolean setupIfNeeded(final GroupHeadSelector groupHeadSelector,
|
public boolean setupIfNeeded(final GroupHeadSelector groupHeadSelector,
|
||||||
final Map readerContext) {
|
@SuppressWarnings({"rawtypes"})final Map readerContext) {
|
||||||
// HACK, but not really any better options until/unless we can recursively
|
// HACK, but not really any better options until/unless we can recursively
|
||||||
// ask value sources if they depend on score
|
// ask value sources if they depend on score
|
||||||
if (wantsCScore(groupHeadSelector.selectorText)) {
|
if (wantsCScore(groupHeadSelector.selectorText)) {
|
||||||
|
@ -1832,6 +1835,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
|
||||||
private ValueSource valueSource;
|
private ValueSource valueSource;
|
||||||
private FunctionValues functionValues;
|
private FunctionValues functionValues;
|
||||||
private IntFloatDynamicMap ordVals;
|
private IntFloatDynamicMap ordVals;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private Map rcontext;
|
private Map rcontext;
|
||||||
private final CollapseScore collapseScore = new CollapseScore();
|
private final CollapseScore collapseScore = new CollapseScore();
|
||||||
private boolean needsScores4Collapsing;
|
private boolean needsScores4Collapsing;
|
||||||
|
@ -2353,6 +2357,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
|
||||||
|
|
||||||
private ValueSource valueSource;
|
private ValueSource valueSource;
|
||||||
private FunctionValues functionValues;
|
private FunctionValues functionValues;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private Map rcontext;
|
private Map rcontext;
|
||||||
private final CollapseScore collapseScore = new CollapseScore();
|
private final CollapseScore collapseScore = new CollapseScore();
|
||||||
private int index=-1;
|
private int index=-1;
|
||||||
|
@ -2632,6 +2637,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
|
||||||
final private int numClauses;
|
final private int numClauses;
|
||||||
final private SortField[] sorts;
|
final private SortField[] sorts;
|
||||||
final private int[] reverseMul;
|
final private int[] reverseMul;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
final private FieldComparator[] fieldComparators;
|
final private FieldComparator[] fieldComparators;
|
||||||
final private LeafFieldComparator[] leafFieldComparators;
|
final private LeafFieldComparator[] leafFieldComparators;
|
||||||
|
|
||||||
|
@ -2642,6 +2648,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
|
||||||
* Constructs an instance based on the the (raw, un-rewritten) SortFields to be used,
|
* Constructs an instance based on the the (raw, un-rewritten) SortFields to be used,
|
||||||
* and an initial number of expected groups (will grow as needed).
|
* and an initial number of expected groups (will grow as needed).
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public SortFieldsCompare(SortField[] sorts, int initNumGroups) {
|
public SortFieldsCompare(SortField[] sorts, int initNumGroups) {
|
||||||
this.sorts = sorts;
|
this.sorts = sorts;
|
||||||
numClauses = sorts.length;
|
numClauses = sorts.length;
|
||||||
|
@ -2757,6 +2764,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
|
||||||
* accordance with the SortFields.
|
* accordance with the SortFields.
|
||||||
* (otherwise returns false)
|
* (otherwise returns false)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
private boolean testAndSetGroupValues(Object[] values, int contextDoc) throws IOException {
|
private boolean testAndSetGroupValues(Object[] values, int contextDoc) throws IOException {
|
||||||
Object[] stash = new Object[numClauses];
|
Object[] stash = new Object[numClauses];
|
||||||
int lastCompare = 0;
|
int lastCompare = 0;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ComplexPhraseQParserPlugin extends QParserPlugin {
|
||||||
private boolean inOrder = true;
|
private boolean inOrder = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
super.init(args);
|
super.init(args);
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
Object val = args.get("inOrder");
|
Object val = args.get("inOrder");
|
||||||
|
|
|
@ -172,6 +172,7 @@ public final class CursorMark {
|
||||||
*
|
*
|
||||||
* @see #getSerializedTotem
|
* @see #getSerializedTotem
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public void parseSerializedTotem(final String serialized) {
|
public void parseSerializedTotem(final String serialized) {
|
||||||
if (CURSOR_MARK_START.equals(serialized)) {
|
if (CURSOR_MARK_START.equals(serialized)) {
|
||||||
values = null;
|
values = null;
|
||||||
|
|
|
@ -95,6 +95,7 @@ public class ExportQParserPlugin extends QParserPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public TopDocsCollector getTopDocsCollector(int len,
|
public TopDocsCollector getTopDocsCollector(int len,
|
||||||
QueryCommand cmd,
|
QueryCommand cmd,
|
||||||
IndexSearcher searcher) throws IOException {
|
IndexSearcher searcher) throws IOException {
|
||||||
|
@ -137,10 +138,12 @@ public class ExportQParserPlugin extends QParserPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private static class ExportCollector extends TopDocsCollector {
|
private static class ExportCollector extends TopDocsCollector {
|
||||||
|
|
||||||
private FixedBitSet[] sets;
|
private FixedBitSet[] sets;
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public ExportCollector(FixedBitSet[] sets) {
|
public ExportCollector(FixedBitSet[] sets) {
|
||||||
super(null);
|
super(null);
|
||||||
this.sets = sets;
|
this.sets = sets;
|
||||||
|
@ -172,6 +175,7 @@ public class ExportQParserPlugin extends QParserPlugin {
|
||||||
return docs;
|
return docs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public TopDocs topDocs(int start, int howMany) {
|
public TopDocs topDocs(int start, int howMany) {
|
||||||
|
|
||||||
assert(sets != null);
|
assert(sets != null);
|
||||||
|
@ -180,6 +184,7 @@ public class ExportQParserPlugin extends QParserPlugin {
|
||||||
|
|
||||||
SolrQueryRequest req = null;
|
SolrQueryRequest req = null;
|
||||||
if(info != null && ((req = info.getReq()) != null)) {
|
if(info != null && ((req = info.getReq()) != null)) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map context = req.getContext();
|
Map context = req.getContext();
|
||||||
context.put("export", sets);
|
context.put("export", sets);
|
||||||
context.put("totalHits", totalHits);
|
context.put("totalHits", totalHits);
|
||||||
|
|
|
@ -53,7 +53,8 @@ public class FloatPayloadValueSource extends ValueSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context
|
||||||
|
, LeafReaderContext readerContext) throws IOException {
|
||||||
|
|
||||||
final Terms terms = readerContext.reader().terms(indexedField);
|
final Terms terms = readerContext.reader().terms(indexedField);
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ public class Grouping {
|
||||||
private final SolrIndexSearcher searcher;
|
private final SolrIndexSearcher searcher;
|
||||||
private final QueryResult qr;
|
private final QueryResult qr;
|
||||||
private final QueryCommand cmd;
|
private final QueryCommand cmd;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private final List<Command> commands = new ArrayList<>();
|
private final List<Command> commands = new ArrayList<>();
|
||||||
private final boolean main;
|
private final boolean main;
|
||||||
private final boolean cacheSecondPassSearch;
|
private final boolean cacheSecondPassSearch;
|
||||||
|
@ -103,6 +104,7 @@ public class Grouping {
|
||||||
private Query query;
|
private Query query;
|
||||||
private DocSet filter;
|
private DocSet filter;
|
||||||
private Filter luceneFilter;
|
private Filter luceneFilter;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private NamedList grouped = new SimpleOrderedMap();
|
private NamedList grouped = new SimpleOrderedMap();
|
||||||
private Set<Integer> idSet = new LinkedHashSet<>(); // used for tracking unique docs when we need a doclist
|
private Set<Integer> idSet = new LinkedHashSet<>(); // used for tracking unique docs when we need a doclist
|
||||||
private int maxMatches; // max number of matches from any grouping command
|
private int maxMatches; // max number of matches from any grouping command
|
||||||
|
@ -134,7 +136,7 @@ public class Grouping {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Grouping.Command groupingCommand) {
|
public void add(@SuppressWarnings({"rawtypes"})Grouping.Command groupingCommand) {
|
||||||
commands.add(groupingCommand);
|
commands.add(groupingCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,6 +182,7 @@ public class Grouping {
|
||||||
public void addFunctionCommand(String groupByStr, SolrQueryRequest request) throws SyntaxError {
|
public void addFunctionCommand(String groupByStr, SolrQueryRequest request) throws SyntaxError {
|
||||||
QParser parser = QParser.getParser(groupByStr, FunctionQParserPlugin.NAME, request);
|
QParser parser = QParser.getParser(groupByStr, FunctionQParserPlugin.NAME, request);
|
||||||
Query q = parser.getQuery();
|
Query q = parser.getQuery();
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
final Grouping.Command gc;
|
final Grouping.Command gc;
|
||||||
if (q instanceof FunctionQuery) {
|
if (q instanceof FunctionQuery) {
|
||||||
ValueSource valueSource = ((FunctionQuery) q).getValueSource();
|
ValueSource valueSource = ((FunctionQuery) q).getValueSource();
|
||||||
|
@ -288,6 +291,7 @@ public class Grouping {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public List<Command> getCommands() {
|
public List<Command> getCommands() {
|
||||||
return commands;
|
return commands;
|
||||||
}
|
}
|
||||||
|
@ -317,13 +321,13 @@ public class Grouping {
|
||||||
getDocList = (cmd.getFlags() & SolrIndexSearcher.GET_DOCLIST) != 0;
|
getDocList = (cmd.getFlags() & SolrIndexSearcher.GET_DOCLIST) != 0;
|
||||||
query = QueryUtils.makeQueryable(cmd.getQuery());
|
query = QueryUtils.makeQueryable(cmd.getQuery());
|
||||||
|
|
||||||
for (Command cmd : commands) {
|
for (@SuppressWarnings({"rawtypes"})Command cmd : commands) {
|
||||||
cmd.prepare();
|
cmd.prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
AllGroupHeadsCollector<?> allGroupHeadsCollector = null;
|
AllGroupHeadsCollector<?> allGroupHeadsCollector = null;
|
||||||
List<Collector> collectors = new ArrayList<>(commands.size());
|
List<Collector> collectors = new ArrayList<>(commands.size());
|
||||||
for (Command cmd : commands) {
|
for (@SuppressWarnings({"rawtypes"})Command cmd : commands) {
|
||||||
Collector collector = cmd.createFirstPassCollector();
|
Collector collector = cmd.createFirstPassCollector();
|
||||||
if (collector != null) {
|
if (collector != null) {
|
||||||
collectors.add(collector);
|
collectors.add(collector);
|
||||||
|
@ -370,7 +374,7 @@ public class Grouping {
|
||||||
}
|
}
|
||||||
|
|
||||||
collectors.clear();
|
collectors.clear();
|
||||||
for (Command cmd : commands) {
|
for (@SuppressWarnings({"rawtypes"})Command cmd : commands) {
|
||||||
Collector collector = cmd.createSecondPassCollector();
|
Collector collector = cmd.createSecondPassCollector();
|
||||||
if (collector != null)
|
if (collector != null)
|
||||||
collectors.add(collector);
|
collectors.add(collector);
|
||||||
|
@ -401,7 +405,7 @@ public class Grouping {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Command cmd : commands) {
|
for (@SuppressWarnings({"rawtypes"})Command cmd : commands) {
|
||||||
cmd.finish();
|
cmd.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,6 +596,7 @@ public class Grouping {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
protected NamedList commonResponse() {
|
protected NamedList commonResponse() {
|
||||||
NamedList groupResult = new SimpleOrderedMap();
|
NamedList groupResult = new SimpleOrderedMap();
|
||||||
grouped.add(key, groupResult); // grouped={ key={
|
grouped.add(key, groupResult); // grouped={ key={
|
||||||
|
@ -606,7 +611,7 @@ public class Grouping {
|
||||||
return groupResult;
|
return groupResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DocList getDocList(GroupDocs groups) {
|
protected DocList getDocList(@SuppressWarnings({"rawtypes"})GroupDocs groups) {
|
||||||
assert groups.totalHits.relation == TotalHits.Relation.EQUAL_TO;
|
assert groups.totalHits.relation == TotalHits.Relation.EQUAL_TO;
|
||||||
int max = Math.toIntExact(groups.totalHits.value);
|
int max = Math.toIntExact(groups.totalHits.value);
|
||||||
int off = groupOffset;
|
int off = groupOffset;
|
||||||
|
@ -640,12 +645,15 @@ public class Grouping {
|
||||||
return docs;
|
return docs;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addDocList(NamedList rsp, GroupDocs groups) {
|
@SuppressWarnings({"unchecked"})
|
||||||
|
protected void addDocList(@SuppressWarnings({"rawtypes"})NamedList rsp
|
||||||
|
, @SuppressWarnings({"rawtypes"})GroupDocs groups) {
|
||||||
rsp.add("doclist", getDocList(groups));
|
rsp.add("doclist", getDocList(groups));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flatten the groups and get up offset + rows documents
|
// Flatten the groups and get up offset + rows documents
|
||||||
protected DocList createSimpleResponse() {
|
protected DocList createSimpleResponse() {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
GroupDocs[] groups = result != null ? result.groups : new GroupDocs[0];
|
GroupDocs[] groups = result != null ? result.groups : new GroupDocs[0];
|
||||||
|
|
||||||
List<Integer> ids = new ArrayList<>();
|
List<Integer> ids = new ArrayList<>();
|
||||||
|
@ -655,7 +663,7 @@ public class Grouping {
|
||||||
float maxScore = Float.NaN;
|
float maxScore = Float.NaN;
|
||||||
|
|
||||||
outer:
|
outer:
|
||||||
for (GroupDocs group : groups) {
|
for (@SuppressWarnings({"rawtypes"})GroupDocs group : groups) {
|
||||||
maxScore = maxAvoidNaN(maxScore, group.maxScore);
|
maxScore = maxAvoidNaN(maxScore, group.maxScore);
|
||||||
|
|
||||||
for (ScoreDoc scoreDoc : group.scoreDocs) {
|
for (ScoreDoc scoreDoc : group.scoreDocs) {
|
||||||
|
@ -768,6 +776,7 @@ public class Grouping {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
protected void finish() throws IOException {
|
protected void finish() throws IOException {
|
||||||
if (secondPass != null) {
|
if (secondPass != null) {
|
||||||
result = secondPass.getTopGroups(0);
|
result = secondPass.getTopGroups(0);
|
||||||
|
@ -778,6 +787,7 @@ public class Grouping {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList groupResult = commonResponse();
|
NamedList groupResult = commonResponse();
|
||||||
|
|
||||||
if (format == Format.simple) {
|
if (format == Format.simple) {
|
||||||
|
@ -785,6 +795,7 @@ public class Grouping {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List groupList = new ArrayList();
|
List groupList = new ArrayList();
|
||||||
groupResult.add("groups", groupList); // grouped={ key={ groups=[
|
groupResult.add("groups", groupList); // grouped={ key={ groups=[
|
||||||
|
|
||||||
|
@ -796,6 +807,7 @@ public class Grouping {
|
||||||
if (numGroups == 0) return;
|
if (numGroups == 0) return;
|
||||||
|
|
||||||
for (GroupDocs<BytesRef> group : result.groups) {
|
for (GroupDocs<BytesRef> group : result.groups) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList nl = new SimpleOrderedMap();
|
NamedList nl = new SimpleOrderedMap();
|
||||||
groupList.add(nl); // grouped={ key={ groups=[ {
|
groupList.add(nl); // grouped={ key={ groups=[ {
|
||||||
|
|
||||||
|
@ -844,6 +856,7 @@ public class Grouping {
|
||||||
* A group command for grouping on a query.
|
* A group command for grouping on a query.
|
||||||
*/
|
*/
|
||||||
//NOTE: doesn't need to be generic. Maybe Command interface --> First / Second pass abstract impl.
|
//NOTE: doesn't need to be generic. Maybe Command interface --> First / Second pass abstract impl.
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public class CommandQuery extends Command {
|
public class CommandQuery extends Command {
|
||||||
|
|
||||||
public Query query;
|
public Query query;
|
||||||
|
@ -911,6 +924,7 @@ public class Grouping {
|
||||||
public class CommandFunc extends Command<MutableValue> {
|
public class CommandFunc extends Command<MutableValue> {
|
||||||
|
|
||||||
public ValueSource groupBy;
|
public ValueSource groupBy;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map context;
|
Map context;
|
||||||
|
|
||||||
private ValueSourceGroupSelector newSelector() {
|
private ValueSourceGroupSelector newSelector() {
|
||||||
|
@ -985,6 +999,7 @@ public class Grouping {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
protected void finish() throws IOException {
|
protected void finish() throws IOException {
|
||||||
if (secondPass != null) {
|
if (secondPass != null) {
|
||||||
result = secondPass.getTopGroups(0);
|
result = secondPass.getTopGroups(0);
|
||||||
|
@ -995,6 +1010,7 @@ public class Grouping {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList groupResult = commonResponse();
|
NamedList groupResult = commonResponse();
|
||||||
|
|
||||||
if (format == Format.simple) {
|
if (format == Format.simple) {
|
||||||
|
@ -1002,6 +1018,7 @@ public class Grouping {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List groupList = new ArrayList();
|
List groupList = new ArrayList();
|
||||||
groupResult.add("groups", groupList); // grouped={ key={ groups=[
|
groupResult.add("groups", groupList); // grouped={ key={ groups=[
|
||||||
|
|
||||||
|
@ -1013,6 +1030,7 @@ public class Grouping {
|
||||||
if (numGroups == 0) return;
|
if (numGroups == 0) return;
|
||||||
|
|
||||||
for (GroupDocs<MutableValue> group : result.groups) {
|
for (GroupDocs<MutableValue> group : result.groups) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList nl = new SimpleOrderedMap();
|
NamedList nl = new SimpleOrderedMap();
|
||||||
groupList.add(nl); // grouped={ key={ groups=[ {
|
groupList.add(nl); // grouped={ key={ groups=[ {
|
||||||
nl.add("groupValue", group.groupValue.toObject());
|
nl.add("groupValue", group.groupValue.toObject());
|
||||||
|
|
|
@ -143,8 +143,10 @@ public class IGainTermsQParserPlugin extends QParserPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void finish() throws IOException {
|
public void finish() throws IOException {
|
||||||
NamedList<Double> analytics = new NamedList<Double>();
|
NamedList<Double> analytics = new NamedList<Double>();
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
NamedList<Integer> topFreq = new NamedList();
|
NamedList<Integer> topFreq = new NamedList();
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
NamedList<Integer> allFreq = new NamedList();
|
NamedList<Integer> allFreq = new NamedList();
|
||||||
|
|
||||||
rb.rsp.add("featuredTerms", analytics);
|
rb.rsp.add("featuredTerms", analytics);
|
||||||
|
|
|
@ -97,7 +97,7 @@ public abstract class QParserPlugin implements NamedListInitializedPlugin, SolrI
|
||||||
public abstract QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req);
|
public abstract QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init( NamedList args ) {
|
public void init( @SuppressWarnings({"rawtypes"})NamedList args ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class QueryContext extends IdentityHashMap implements Closeable {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public QueryContext(IndexSearcher searcher) {
|
public QueryContext(IndexSearcher searcher) {
|
||||||
this.searcher = searcher instanceof SolrIndexSearcher ? (SolrIndexSearcher)searcher : null;
|
this.searcher = searcher instanceof SolrIndexSearcher ? (SolrIndexSearcher)searcher : null;
|
||||||
indexSearcher = searcher;
|
indexSearcher = searcher;
|
||||||
|
|
|
@ -251,6 +251,7 @@ public class QueryParsing {
|
||||||
|
|
||||||
out.append(q.includesUpper() ? ']' : '}');
|
out.append(q.includesUpper() ? ']' : '}');
|
||||||
} else if (query instanceof LegacyNumericRangeQuery) {
|
} else if (query instanceof LegacyNumericRangeQuery) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
LegacyNumericRangeQuery q = (LegacyNumericRangeQuery) query;
|
LegacyNumericRangeQuery q = (LegacyNumericRangeQuery) query;
|
||||||
String fname = q.getField();
|
String fname = q.getField();
|
||||||
FieldType ft = writeFieldName(fname, schema, out, flags);
|
FieldType ft = writeFieldName(fname, schema, out, flags);
|
||||||
|
|
|
@ -29,6 +29,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
public abstract class RankQuery extends ExtendedQueryBase {
|
public abstract class RankQuery extends ExtendedQueryBase {
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public abstract TopDocsCollector getTopDocsCollector(int len, QueryCommand cmd, IndexSearcher searcher) throws IOException;
|
public abstract TopDocsCollector getTopDocsCollector(int len, QueryCommand cmd, IndexSearcher searcher) throws IOException;
|
||||||
public abstract MergeStrategy getMergeStrategy();
|
public abstract MergeStrategy getMergeStrategy();
|
||||||
public abstract RankQuery wrap(Query mainQuery);
|
public abstract RankQuery wrap(Query mainQuery);
|
||||||
|
|
|
@ -42,8 +42,10 @@ import org.apache.solr.handler.component.QueryElevationComponent;
|
||||||
import org.apache.solr.request.SolrRequestInfo;
|
import org.apache.solr.request.SolrRequestInfo;
|
||||||
|
|
||||||
/* A TopDocsCollector used by reranking queries. */
|
/* A TopDocsCollector used by reranking queries. */
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public class ReRankCollector extends TopDocsCollector {
|
public class ReRankCollector extends TopDocsCollector {
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
final private TopDocsCollector mainCollector;
|
final private TopDocsCollector mainCollector;
|
||||||
final private IndexSearcher searcher;
|
final private IndexSearcher searcher;
|
||||||
final private int reRankDocs;
|
final private int reRankDocs;
|
||||||
|
@ -54,6 +56,7 @@ public class ReRankCollector extends TopDocsCollector {
|
||||||
final private Query query;
|
final private Query query;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public ReRankCollector(int reRankDocs,
|
public ReRankCollector(int reRankDocs,
|
||||||
int length,
|
int length,
|
||||||
Rescorer reRankQueryRescorer,
|
Rescorer reRankQueryRescorer,
|
||||||
|
@ -92,6 +95,7 @@ public class ReRankCollector extends TopDocsCollector {
|
||||||
return sort == null || sort.needsScores() ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES;
|
return sort == null || sort.needsScores() ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public TopDocs topDocs(int start, int howMany) {
|
public TopDocs topDocs(int start, int howMany) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -152,6 +156,7 @@ public class ReRankCollector extends TopDocsCollector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public static class BoostedComp implements Comparator {
|
public static class BoostedComp implements Comparator {
|
||||||
IntFloatHashMap boostedMap;
|
IntFloatHashMap boostedMap;
|
||||||
|
|
||||||
|
|
|
@ -134,12 +134,18 @@ public class SignificantTermsQParserPlugin extends QParserPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finish() throws IOException {
|
public void finish() throws IOException {
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
List<String> outTerms = new ArrayList();
|
List<String> outTerms = new ArrayList();
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
List<Integer> outFreq = new ArrayList();
|
List<Integer> outFreq = new ArrayList();
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
List<Integer> outQueryFreq = new ArrayList();
|
List<Integer> outQueryFreq = new ArrayList();
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
List<Double> scores = new ArrayList();
|
List<Double> scores = new ArrayList();
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
NamedList<Integer> allFreq = new NamedList();
|
NamedList<Integer> allFreq = new NamedList();
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
NamedList<Integer> allQueryFreq = new NamedList();
|
NamedList<Integer> allQueryFreq = new NamedList();
|
||||||
|
|
||||||
LinkedHashMap<String, Object> response = new LinkedHashMap<>();
|
LinkedHashMap<String, Object> response = new LinkedHashMap<>();
|
||||||
|
|
|
@ -64,7 +64,7 @@ public interface SolrCache<K,V> extends SolrInfoBean {
|
||||||
* regenerate an item in the new cache from an entry in the old cache.
|
* regenerate an item in the new cache from an entry in the old cache.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Object init(Map args, Object persistence, CacheRegenerator regenerator);
|
public Object init(@SuppressWarnings({"rawtypes"})Map args, Object persistence, CacheRegenerator regenerator);
|
||||||
// I don't think we need a factory for faster creation given that these
|
// I don't think we need a factory for faster creation given that these
|
||||||
// will be associated with slow-to-create SolrIndexSearchers.
|
// will be associated with slow-to-create SolrIndexSearchers.
|
||||||
// change to NamedList when other plugins do?
|
// change to NamedList when other plugins do?
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class SolrConstantScoreQuery extends Query implements ExtendedQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class ConstantWeight extends ConstantScoreWeight {
|
protected class ConstantWeight extends ConstantScoreWeight {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private Map context;
|
private Map context;
|
||||||
private ScoreMode scoreMode;
|
private ScoreMode scoreMode;
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class SolrCoreParser extends CoreParser implements NamedListInitializedPl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public void init(NamedList initArgs) {
|
public void init(NamedList initArgs) {
|
||||||
if (initArgs == null || initArgs.size() == 0) {
|
if (initArgs == null || initArgs.size() == 0) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -108,6 +108,7 @@ public class SolrDocumentFetcher {
|
||||||
|
|
||||||
private Collection<String> storedHighlightFieldNames; // lazy populated; use getter
|
private Collection<String> storedHighlightFieldNames; // lazy populated; use getter
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
SolrDocumentFetcher(SolrIndexSearcher searcher, SolrConfig solrConfig, boolean cachingEnabled) {
|
SolrDocumentFetcher(SolrIndexSearcher searcher, SolrConfig solrConfig, boolean cachingEnabled) {
|
||||||
this.searcher = searcher;
|
this.searcher = searcher;
|
||||||
this.enableLazyFieldLoading = solrConfig.enableLazyFieldLoading;
|
this.enableLazyFieldLoading = solrConfig.enableLazyFieldLoading;
|
||||||
|
|
|
@ -34,9 +34,11 @@ public abstract class SolrFilter extends Filter {
|
||||||
|
|
||||||
/** Implementations should propagate createWeight to sub-ValueSources which can store weight info in the context.
|
/** Implementations should propagate createWeight to sub-ValueSources which can store weight info in the context.
|
||||||
* The context object will be passed to getDocIdSet() where this info can be retrieved. */
|
* The context object will be passed to getDocIdSet() where this info can be retrieved. */
|
||||||
public abstract void createWeight(Map context, IndexSearcher searcher) throws IOException;
|
public abstract void createWeight(@SuppressWarnings({"rawtypes"})Map context
|
||||||
|
, IndexSearcher searcher) throws IOException;
|
||||||
|
|
||||||
public abstract DocIdSet getDocIdSet(Map context, LeafReaderContext readerContext, Bits acceptDocs) throws IOException;
|
public abstract DocIdSet getDocIdSet(@SuppressWarnings({"rawtypes"})Map context
|
||||||
|
, LeafReaderContext readerContext, Bits acceptDocs) throws IOException;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException {
|
public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException {
|
||||||
|
|
|
@ -97,7 +97,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
// These should *only* be used for debugging or monitoring purposes
|
// These should *only* be used for debugging or monitoring purposes
|
||||||
public static final AtomicLong numOpens = new AtomicLong();
|
public static final AtomicLong numOpens = new AtomicLong();
|
||||||
public static final AtomicLong numCloses = new AtomicLong();
|
public static final AtomicLong numCloses = new AtomicLong();
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private static final Map<String,SolrCache> NO_GENERIC_CACHES = Collections.emptyMap();
|
private static final Map<String,SolrCache> NO_GENERIC_CACHES = Collections.emptyMap();
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private static final SolrCache[] NO_CACHES = new SolrCache[0];
|
private static final SolrCache[] NO_CACHES = new SolrCache[0];
|
||||||
|
|
||||||
private final SolrCore core;
|
private final SolrCore core;
|
||||||
|
@ -122,9 +124,11 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
private final SolrCache<String,UnInvertedField> fieldValueCache;
|
private final SolrCache<String,UnInvertedField> fieldValueCache;
|
||||||
|
|
||||||
// map of generic caches - not synchronized since it's read-only after the constructor.
|
// map of generic caches - not synchronized since it's read-only after the constructor.
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private final Map<String,SolrCache> cacheMap;
|
private final Map<String,SolrCache> cacheMap;
|
||||||
|
|
||||||
// list of all caches associated with this searcher.
|
// list of all caches associated with this searcher.
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private final SolrCache[] cacheList;
|
private final SolrCache[] cacheList;
|
||||||
|
|
||||||
private DirectoryFactory directoryFactory;
|
private DirectoryFactory directoryFactory;
|
||||||
|
@ -229,6 +233,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
this.releaseDirectory = true;
|
this.releaseDirectory = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, String name, DirectoryReader r,
|
public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, String name, DirectoryReader r,
|
||||||
boolean closeReader, boolean enableCache, boolean reserveDirectory, DirectoryFactory directoryFactory)
|
boolean closeReader, boolean enableCache, boolean reserveDirectory, DirectoryFactory directoryFactory)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -428,12 +433,12 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
// register self
|
// register self
|
||||||
infoRegistry.put(STATISTICS_KEY, this);
|
infoRegistry.put(STATISTICS_KEY, this);
|
||||||
infoRegistry.put(name, this);
|
infoRegistry.put(name, this);
|
||||||
for (SolrCache cache : cacheList) {
|
for (@SuppressWarnings({"rawtypes"})SolrCache cache : cacheList) {
|
||||||
cache.setState(SolrCache.State.LIVE);
|
cache.setState(SolrCache.State.LIVE);
|
||||||
infoRegistry.put(cache.name(), cache);
|
infoRegistry.put(cache.name(), cache);
|
||||||
}
|
}
|
||||||
this.solrMetricsContext = core.getSolrMetricsContext().getChildContext(this);
|
this.solrMetricsContext = core.getSolrMetricsContext().getChildContext(this);
|
||||||
for (SolrCache cache : cacheList) {
|
for (@SuppressWarnings({"rawtypes"})SolrCache cache : cacheList) {
|
||||||
cache.initializeMetrics(solrMetricsContext, SolrMetricManager.mkName(cache.name(), STATISTICS_KEY));
|
cache.initializeMetrics(solrMetricsContext, SolrMetricManager.mkName(cache.name(), STATISTICS_KEY));
|
||||||
}
|
}
|
||||||
initializeMetrics(solrMetricsContext, STATISTICS_KEY);
|
initializeMetrics(solrMetricsContext, STATISTICS_KEY);
|
||||||
|
@ -451,7 +456,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
if (cachingEnabled) {
|
if (cachingEnabled) {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Closing ").append(name);
|
sb.append("Closing ").append(name);
|
||||||
for (SolrCache cache : cacheList) {
|
for (@SuppressWarnings({"rawtypes"})SolrCache cache : cacheList) {
|
||||||
sb.append("\n\t");
|
sb.append("\n\t");
|
||||||
sb.append(cache);
|
sb.append(cache);
|
||||||
}
|
}
|
||||||
|
@ -478,7 +483,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
core.getDeletionPolicy().releaseCommitPoint(cpg);
|
core.getDeletionPolicy().releaseCommitPoint(cpg);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SolrCache cache : cacheList) {
|
for (@SuppressWarnings({"rawtypes"})SolrCache cache : cacheList) {
|
||||||
try {
|
try {
|
||||||
cache.close();
|
cache.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -524,7 +529,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
if (solrConfig.fieldValueCacheConfig != null && solrConfig.fieldValueCacheConfig.getRegenerator() == null) {
|
if (solrConfig.fieldValueCacheConfig != null && solrConfig.fieldValueCacheConfig.getRegenerator() == null) {
|
||||||
solrConfig.fieldValueCacheConfig.setRegenerator(new CacheRegenerator() {
|
solrConfig.fieldValueCacheConfig.setRegenerator(new CacheRegenerator() {
|
||||||
@Override
|
@Override
|
||||||
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache, SolrCache oldCache,
|
public boolean regenerateItem(SolrIndexSearcher newSearcher,
|
||||||
|
@SuppressWarnings({"rawtypes"})SolrCache newCache,
|
||||||
|
@SuppressWarnings({"rawtypes"})SolrCache oldCache,
|
||||||
Object oldKey, Object oldVal) throws IOException {
|
Object oldKey, Object oldVal) throws IOException {
|
||||||
if (oldVal instanceof UnInvertedField) {
|
if (oldVal instanceof UnInvertedField) {
|
||||||
UnInvertedField.getUnInvertedField((String) oldKey, newSearcher);
|
UnInvertedField.getUnInvertedField((String) oldKey, newSearcher);
|
||||||
|
@ -537,7 +544,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
if (solrConfig.filterCacheConfig != null && solrConfig.filterCacheConfig.getRegenerator() == null) {
|
if (solrConfig.filterCacheConfig != null && solrConfig.filterCacheConfig.getRegenerator() == null) {
|
||||||
solrConfig.filterCacheConfig.setRegenerator(new CacheRegenerator() {
|
solrConfig.filterCacheConfig.setRegenerator(new CacheRegenerator() {
|
||||||
@Override
|
@Override
|
||||||
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache, SolrCache oldCache,
|
@SuppressWarnings({"rawtypes"})public boolean regenerateItem(SolrIndexSearcher newSearcher
|
||||||
|
, @SuppressWarnings({"rawtypes"})SolrCache newCache
|
||||||
|
, @SuppressWarnings({"rawtypes"})SolrCache oldCache,
|
||||||
Object oldKey, Object oldVal) throws IOException {
|
Object oldKey, Object oldVal) throws IOException {
|
||||||
newSearcher.cacheDocSet((Query) oldKey, null, false);
|
newSearcher.cacheDocSet((Query) oldKey, null, false);
|
||||||
return true;
|
return true;
|
||||||
|
@ -549,6 +558,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
final int queryResultWindowSize = solrConfig.queryResultWindowSize;
|
final int queryResultWindowSize = solrConfig.queryResultWindowSize;
|
||||||
solrConfig.queryResultCacheConfig.setRegenerator(new CacheRegenerator() {
|
solrConfig.queryResultCacheConfig.setRegenerator(new CacheRegenerator() {
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache, SolrCache oldCache,
|
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache, SolrCache oldCache,
|
||||||
Object oldKey, Object oldVal) throws IOException {
|
Object oldKey, Object oldVal) throws IOException {
|
||||||
QueryResultKey key = (QueryResultKey) oldKey;
|
QueryResultKey key = (QueryResultKey) oldKey;
|
||||||
|
@ -1484,6 +1494,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
* @param cmd
|
* @param cmd
|
||||||
* The Command whose properties should determine the type of TopDocsCollector to use.
|
* The Command whose properties should determine the type of TopDocsCollector to use.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private TopDocsCollector buildTopDocsCollector(int len, QueryCommand cmd) throws IOException {
|
private TopDocsCollector buildTopDocsCollector(int len, QueryCommand cmd) throws IOException {
|
||||||
int minNumFound = cmd.getMinExactCount();
|
int minNumFound = cmd.getMinExactCount();
|
||||||
Query q = cmd.getQuery();
|
Query q = cmd.getQuery();
|
||||||
|
@ -1679,6 +1690,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
// no docs on this page, so cursor doesn't change
|
// no docs on this page, so cursor doesn't change
|
||||||
qr.setNextCursorMark(cmd.getCursorMark());
|
qr.setNextCursorMark(cmd.getCursorMark());
|
||||||
} else {
|
} else {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
final TopDocsCollector topCollector = buildTopDocsCollector(len, cmd);
|
final TopDocsCollector topCollector = buildTopDocsCollector(len, cmd);
|
||||||
DocSetCollector setCollector = new DocSetCollector(maxDoc);
|
DocSetCollector setCollector = new DocSetCollector(maxDoc);
|
||||||
MaxScoreCollector maxScoreCollector = null;
|
MaxScoreCollector maxScoreCollector = null;
|
||||||
|
@ -1999,6 +2011,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
// bit of a hack to tell if a set is sorted - do it better in the future.
|
// bit of a hack to tell if a set is sorted - do it better in the future.
|
||||||
boolean inOrder = set instanceof BitDocSet || set instanceof SortedIntDocSet;
|
boolean inOrder = set instanceof BitDocSet || set instanceof SortedIntDocSet;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
TopDocsCollector topCollector = buildTopDocsCollector(nDocs, cmd);
|
TopDocsCollector topCollector = buildTopDocsCollector(nDocs, cmd);
|
||||||
|
|
||||||
DocIterator iter = set.iterator();
|
DocIterator iter = set.iterator();
|
||||||
|
@ -2121,6 +2134,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
/**
|
/**
|
||||||
* Warm this searcher based on an old one (primarily for auto-cache warming).
|
* Warm this searcher based on an old one (primarily for auto-cache warming).
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public void warm(SolrIndexSearcher old) {
|
public void warm(SolrIndexSearcher old) {
|
||||||
// Make sure this is first! filters can help queryResults execute!
|
// Make sure this is first! filters can help queryResults execute!
|
||||||
long warmingStartTime = System.nanoTime();
|
long warmingStartTime = System.nanoTime();
|
||||||
|
@ -2165,6 +2179,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
/**
|
/**
|
||||||
* return the named generic cache
|
* return the named generic cache
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public SolrCache getCache(String cacheName) {
|
public SolrCache getCache(String cacheName) {
|
||||||
return cacheMap.get(cacheName);
|
return cacheMap.get(cacheName);
|
||||||
}
|
}
|
||||||
|
@ -2172,7 +2187,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
/**
|
/**
|
||||||
* lookup an entry in a generic cache
|
* lookup an entry in a generic cache
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public Object cacheLookup(String cacheName, Object key) {
|
public Object cacheLookup(String cacheName, Object key) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
SolrCache cache = cacheMap.get(cacheName);
|
SolrCache cache = cacheMap.get(cacheName);
|
||||||
return cache == null ? null : cache.get(key);
|
return cache == null ? null : cache.get(key);
|
||||||
}
|
}
|
||||||
|
@ -2180,7 +2197,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
||||||
/**
|
/**
|
||||||
* insert an entry in a generic cache
|
* insert an entry in a generic cache
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public Object cacheInsert(String cacheName, Object key, Object val) {
|
public Object cacheInsert(String cacheName, Object key, Object val) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
SolrCache cache = cacheMap.get(cacheName);
|
SolrCache cache = cacheMap.get(cacheName);
|
||||||
return cache == null ? null : cache.put(key, val);
|
return cache == null ? null : cache.put(key, val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class TextLogisticRegressionQParserPlugin extends QParserPlugin {
|
||||||
public static final String NAME = "tlogit";
|
public static final String NAME = "tlogit";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -165,6 +165,7 @@ public class TextLogisticRegressionQParserPlugin extends QParserPlugin {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public void finish() throws IOException {
|
public void finish() throws IOException {
|
||||||
|
|
||||||
Map<Integer, double[]> docVectors = new HashMap<>();
|
Map<Integer, double[]> docVectors = new HashMap<>();
|
||||||
|
@ -211,6 +212,7 @@ public class TextLogisticRegressionQParserPlugin extends QParserPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList analytics = new NamedList();
|
NamedList analytics = new NamedList();
|
||||||
rbsp.rsp.add("logit", analytics);
|
rbsp.rsp.add("logit", analytics);
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
|
||||||
* Initialize the plugin.
|
* Initialize the plugin.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {}
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the user input into a ValueSource.
|
* Parse the user input into a ValueSource.
|
||||||
|
@ -1186,7 +1186,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
|
||||||
|
|
||||||
static class DateValueSourceParser extends ValueSourceParser {
|
static class DateValueSourceParser extends ValueSourceParser {
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDate(FunctionQParser fp, String arg) {
|
public Date getDate(FunctionQParser fp, String arg) {
|
||||||
|
@ -1304,7 +1304,8 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context
|
||||||
|
, LeafReaderContext readerContext) throws IOException {
|
||||||
return new LongDocValues(this) {
|
return new LongDocValues(this) {
|
||||||
@Override
|
@Override
|
||||||
public float floatVal(int doc) {
|
public float floatVal(int doc) {
|
||||||
|
@ -1409,7 +1410,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException {
|
||||||
final FunctionValues vals = source.getValues(context, readerContext);
|
final FunctionValues vals = source.getValues(context, readerContext);
|
||||||
return new DoubleDocValues(this) {
|
return new DoubleDocValues(this) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1456,7 +1457,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException {
|
||||||
final FunctionValues aVals = a.getValues(context, readerContext);
|
final FunctionValues aVals = a.getValues(context, readerContext);
|
||||||
final FunctionValues bVals = b.getValues(context, readerContext);
|
final FunctionValues bVals = b.getValues(context, readerContext);
|
||||||
return new DoubleDocValues(this) {
|
return new DoubleDocValues(this) {
|
||||||
|
@ -1472,7 +1473,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
|
public void createWeight(@SuppressWarnings({"rawtypes"})Map context, IndexSearcher searcher) throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1512,7 +1513,8 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context,
|
||||||
|
LeafReaderContext readerContext) throws IOException {
|
||||||
return new BoolDocValues(this) {
|
return new BoolDocValues(this) {
|
||||||
@Override
|
@Override
|
||||||
public boolean boolVal(int doc) {
|
public boolean boolVal(int doc) {
|
||||||
|
@ -1572,7 +1574,8 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context
|
||||||
|
, LeafReaderContext readerContext) throws IOException {
|
||||||
if (context.get(this) == null) {
|
if (context.get(this) == null) {
|
||||||
SolrRequestInfo requestInfo = SolrRequestInfo.getRequestInfo();
|
SolrRequestInfo requestInfo = SolrRequestInfo.getRequestInfo();
|
||||||
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "testfunc: unweighted value source detected. delegate="+source + " request=" + (requestInfo==null ? "null" : requestInfo.getReq()));
|
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "testfunc: unweighted value source detected. delegate="+source + " request=" + (requestInfo==null ? "null" : requestInfo.getReq()));
|
||||||
|
@ -1596,7 +1599,8 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
|
@SuppressWarnings({"unchecked"})
|
||||||
|
public void createWeight(@SuppressWarnings({"rawtypes"})Map context, IndexSearcher searcher) throws IOException {
|
||||||
context.put(this, this);
|
context.put(this, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,10 +66,11 @@ import org.apache.solr.schema.IndexSchema;
|
||||||
public class XmlQParserPlugin extends QParserPlugin {
|
public class XmlQParserPlugin extends QParserPlugin {
|
||||||
public static final String NAME = "xmlparser";
|
public static final String NAME = "xmlparser";
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private NamedList args;
|
private NamedList args;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init( NamedList args ) {
|
public void init( @SuppressWarnings({"rawtypes"})NamedList args ) {
|
||||||
super.init(args);
|
super.init(args);
|
||||||
this.args = args;
|
this.args = args;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ public class CommandHandler {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private QueryCommand queryCommand;
|
private QueryCommand queryCommand;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private List<Command> commands = new ArrayList<>();
|
private List<Command> commands = new ArrayList<>();
|
||||||
private SolrIndexSearcher searcher;
|
private SolrIndexSearcher searcher;
|
||||||
private boolean needDocSet = false;
|
private boolean needDocSet = false;
|
||||||
|
@ -71,7 +72,7 @@ public class CommandHandler {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder addCommandField(Command commandField) {
|
public Builder addCommandField(@SuppressWarnings({"rawtypes"})Command commandField) {
|
||||||
commands.add(commandField);
|
commands.add(commandField);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -116,6 +117,7 @@ public class CommandHandler {
|
||||||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||||
|
|
||||||
private final QueryCommand queryCommand;
|
private final QueryCommand queryCommand;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private final List<Command> commands;
|
private final List<Command> commands;
|
||||||
private final SolrIndexSearcher searcher;
|
private final SolrIndexSearcher searcher;
|
||||||
private final boolean needDocset;
|
private final boolean needDocset;
|
||||||
|
@ -127,7 +129,7 @@ public class CommandHandler {
|
||||||
private DocSet docSet;
|
private DocSet docSet;
|
||||||
|
|
||||||
private CommandHandler(QueryCommand queryCommand,
|
private CommandHandler(QueryCommand queryCommand,
|
||||||
List<Command> commands,
|
@SuppressWarnings({"rawtypes"})List<Command> commands,
|
||||||
SolrIndexSearcher searcher,
|
SolrIndexSearcher searcher,
|
||||||
boolean needDocset,
|
boolean needDocset,
|
||||||
boolean truncateGroups,
|
boolean truncateGroups,
|
||||||
|
@ -144,7 +146,7 @@ public class CommandHandler {
|
||||||
public void execute() throws IOException {
|
public void execute() throws IOException {
|
||||||
final int nrOfCommands = commands.size();
|
final int nrOfCommands = commands.size();
|
||||||
List<Collector> collectors = new ArrayList<>(nrOfCommands);
|
List<Collector> collectors = new ArrayList<>(nrOfCommands);
|
||||||
for (Command command : commands) {
|
for (@SuppressWarnings({"rawtypes"})Command command : commands) {
|
||||||
collectors.addAll(command.create());
|
collectors.addAll(command.create());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,17 +164,19 @@ public class CommandHandler {
|
||||||
searchWithTimeLimiter(query, filter, null);
|
searchWithTimeLimiter(query, filter, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Command command : commands) {
|
for (@SuppressWarnings({"rawtypes"})Command command : commands) {
|
||||||
command.postCollect(searcher);
|
command.postCollect(searcher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DocSet computeGroupedDocSet(Query query, ProcessedFilter filter, List<Collector> collectors) throws IOException {
|
private DocSet computeGroupedDocSet(Query query, ProcessedFilter filter, List<Collector> collectors) throws IOException {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Command firstCommand = commands.get(0);
|
Command firstCommand = commands.get(0);
|
||||||
String field = firstCommand.getKey();
|
String field = firstCommand.getKey();
|
||||||
SchemaField sf = searcher.getSchema().getField(field);
|
SchemaField sf = searcher.getSchema().getField(field);
|
||||||
FieldType fieldType = sf.getType();
|
FieldType fieldType = sf.getType();
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
final AllGroupHeadsCollector allGroupHeadsCollector;
|
final AllGroupHeadsCollector allGroupHeadsCollector;
|
||||||
if (fieldType.getNumberType() != null) {
|
if (fieldType.getNumberType() != null) {
|
||||||
ValueSource vs = fieldType.getValueSource(sf, null);
|
ValueSource vs = fieldType.getValueSource(sf, null);
|
||||||
|
@ -201,7 +205,7 @@ public class CommandHandler {
|
||||||
return DocSetUtil.getDocSet( docSetCollector, searcher );
|
return DocSetUtil.getDocSet( docSetCollector, searcher );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public NamedList processResult(QueryResult queryResult, ShardResultTransformer transformer) throws IOException {
|
public NamedList processResult(QueryResult queryResult, ShardResultTransformer transformer) throws IOException {
|
||||||
if (docSet != null) {
|
if (docSet != null) {
|
||||||
queryResult.setDocSet(docSet);
|
queryResult.setDocSet(docSet);
|
||||||
|
|
|
@ -133,16 +133,16 @@ class GroupConverter {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
static TopGroups<BytesRef> fromMutable(SchemaField field, TopGroups<MutableValue> values) {
|
static TopGroups<BytesRef> fromMutable(SchemaField field, TopGroups<MutableValue> values) {
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
FieldType fieldType = field.getType();
|
FieldType fieldType = field.getType();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
GroupDocs<BytesRef> groupDocs[] = new GroupDocs[values.groups.length];
|
GroupDocs<BytesRef> groupDocs[] = new GroupDocs[values.groups.length];
|
||||||
|
|
||||||
for (int i = 0; i < values.groups.length; i++) {
|
for (int i = 0; i < values.groups.length; i++) {
|
||||||
GroupDocs<MutableValue> original = values.groups[i];
|
GroupDocs<MutableValue> original = values.groups[i];
|
||||||
final BytesRef groupValue;
|
final BytesRef groupValue;
|
||||||
|
|
|
@ -138,6 +138,7 @@ public class QueryCommand implements Command<QueryCommandResult> {
|
||||||
private final String queryString;
|
private final String queryString;
|
||||||
private final Query mainQuery;
|
private final Query mainQuery;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private TopDocsCollector topDocsCollector;
|
private TopDocsCollector topDocsCollector;
|
||||||
private FilterCollector filterCollector;
|
private FilterCollector filterCollector;
|
||||||
private MaxScoreCollector maxScoreCollector;
|
private MaxScoreCollector maxScoreCollector;
|
||||||
|
|
|
@ -83,7 +83,9 @@ public class SearchGroupsFieldCommand implements Command<SearchGroupsFieldComman
|
||||||
private final int topNGroups;
|
private final int topNGroups;
|
||||||
private final boolean includeGroupCount;
|
private final boolean includeGroupCount;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private FirstPassGroupingCollector firstPassGroupingCollector;
|
private FirstPassGroupingCollector firstPassGroupingCollector;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private AllGroupsCollector allGroupsCollector;
|
private AllGroupsCollector allGroupsCollector;
|
||||||
|
|
||||||
private SearchGroupsFieldCommand(SchemaField field, Sort groupSort, int topNGroups, boolean includeGroupCount) {
|
private SearchGroupsFieldCommand(SchemaField field, Sort groupSort, int topNGroups, boolean includeGroupCount) {
|
||||||
|
@ -121,6 +123,7 @@ public class SearchGroupsFieldCommand implements Command<SearchGroupsFieldComman
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public SearchGroupsFieldCommandResult result() throws IOException {
|
public SearchGroupsFieldCommandResult result() throws IOException {
|
||||||
final Collection<SearchGroup<BytesRef>> topGroups;
|
final Collection<SearchGroup<BytesRef>> topGroups;
|
||||||
if (firstPassGroupingCollector != null) {
|
if (firstPassGroupingCollector != null) {
|
||||||
|
|
|
@ -116,6 +116,7 @@ public class TopGroupsFieldCommand implements Command<TopGroups<BytesRef>> {
|
||||||
private final int maxDocPerGroup;
|
private final int maxDocPerGroup;
|
||||||
private final boolean needScores;
|
private final boolean needScores;
|
||||||
private final boolean needMaxScore;
|
private final boolean needMaxScore;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private TopGroupsCollector secondPassCollector;
|
private TopGroupsCollector secondPassCollector;
|
||||||
private TopGroups<BytesRef> topGroups;
|
private TopGroups<BytesRef> topGroups;
|
||||||
|
|
||||||
|
@ -161,6 +162,7 @@ public class TopGroupsFieldCommand implements Command<TopGroups<BytesRef>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public void postCollect(IndexSearcher searcher) throws IOException {
|
public void postCollect(IndexSearcher searcher) throws IOException {
|
||||||
if (firstPhaseGroups.isEmpty()) {
|
if (firstPhaseGroups.isEmpty()) {
|
||||||
topGroups = new TopGroups<>(groupSort.getSort(), withinGroupSort.getSort(), 0, 0, new GroupDocs[0], Float.NaN);
|
topGroups = new TopGroups<>(groupSort.getSort(), withinGroupSort.getSort(), 0, 0, new GroupDocs[0], Float.NaN);
|
||||||
|
|
|
@ -48,6 +48,7 @@ import org.apache.solr.search.grouping.distributed.shardresultserializer.SearchG
|
||||||
public class SearchGroupShardResponseProcessor implements ShardResponseProcessor {
|
public class SearchGroupShardResponseProcessor implements ShardResponseProcessor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public void process(ResponseBuilder rb, ShardRequest shardRequest) {
|
public void process(ResponseBuilder rb, ShardRequest shardRequest) {
|
||||||
SortSpec groupSortSpec = rb.getGroupingSpec().getGroupSortSpec();
|
SortSpec groupSortSpec = rb.getGroupingSpec().getGroupSortSpec();
|
||||||
Sort groupSort = rb.getGroupingSpec().getGroupSortSpec().getSort();
|
Sort groupSort = rb.getGroupingSpec().getGroupSortSpec().getSort();
|
||||||
|
@ -104,7 +105,7 @@ public class SearchGroupShardResponseProcessor implements ShardResponseProcessor
|
||||||
continue; // continue if there was an error and we're tolerant.
|
continue; // continue if there was an error and we're tolerant.
|
||||||
}
|
}
|
||||||
maxElapsedTime = (int) Math.max(maxElapsedTime, srsp.getSolrResponse().getElapsedTime());
|
maxElapsedTime = (int) Math.max(maxElapsedTime, srsp.getSolrResponse().getElapsedTime());
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList<NamedList> firstPhaseResult = (NamedList<NamedList>) srsp.getSolrResponse().getResponse().get("firstPhase");
|
NamedList<NamedList> firstPhaseResult = (NamedList<NamedList>) srsp.getSolrResponse().getResponse().get("firstPhase");
|
||||||
final Map<String, SearchGroupsFieldCommandResult> result = serializer.transformToNative(firstPhaseResult, groupSort, withinGroupSort, srsp.getShard());
|
final Map<String, SearchGroupsFieldCommandResult> result = serializer.transformToNative(firstPhaseResult, groupSort, withinGroupSort, srsp.getShard());
|
||||||
for (Map.Entry<String, List<Collection<SearchGroup<BytesRef>>>> entry : commandSearchGroups.entrySet()) {
|
for (Map.Entry<String, List<Collection<SearchGroup<BytesRef>>>> entry : commandSearchGroups.entrySet()) {
|
||||||
|
|
|
@ -119,6 +119,7 @@ public class TopGroupsShardResponseProcessor implements ShardResponseProcessor {
|
||||||
rb.rsp.getResponseHeader().asShallowMap().put(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY, Boolean.TRUE);
|
rb.rsp.getResponseHeader().asShallowMap().put(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY, Boolean.TRUE);
|
||||||
continue; // continue if there was an error and we're tolerant.
|
continue; // continue if there was an error and we're tolerant.
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList<NamedList> secondPhaseResult = (NamedList<NamedList>) srsp.getSolrResponse().getResponse().get("secondPhase");
|
NamedList<NamedList> secondPhaseResult = (NamedList<NamedList>) srsp.getSolrResponse().getResponse().get("secondPhase");
|
||||||
if(secondPhaseResult == null)
|
if(secondPhaseResult == null)
|
||||||
continue;
|
continue;
|
||||||
|
@ -156,11 +157,12 @@ public class TopGroupsShardResponseProcessor implements ShardResponseProcessor {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
TopGroups<BytesRef>[] topGroupsArr = new TopGroups[topGroups.size()];
|
TopGroups<BytesRef>[] topGroupsArr = new TopGroups[topGroups.size()];
|
||||||
int docsPerGroup = docsPerGroupDefault;
|
int docsPerGroup = docsPerGroupDefault;
|
||||||
if (docsPerGroup < 0) {
|
if (docsPerGroup < 0) {
|
||||||
docsPerGroup = 0;
|
docsPerGroup = 0;
|
||||||
for (TopGroups subTopGroups : topGroups) {
|
for (@SuppressWarnings({"rawtypes"})TopGroups subTopGroups : topGroups) {
|
||||||
docsPerGroup += subTopGroups.totalGroupedHitCount;
|
docsPerGroup += subTopGroups.totalGroupedHitCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import java.util.*;
|
||||||
/**
|
/**
|
||||||
* Implementation for transforming {@link SearchGroup} into a {@link NamedList} structure and visa versa.
|
* Implementation for transforming {@link SearchGroup} into a {@link NamedList} structure and visa versa.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public class SearchGroupsResultTransformer implements ShardResultTransformer<List<Command>, Map<String, SearchGroupsFieldCommandResult>> {
|
public class SearchGroupsResultTransformer implements ShardResultTransformer<List<Command>, Map<String, SearchGroupsFieldCommandResult>> {
|
||||||
|
|
||||||
private static final String TOP_GROUPS = "topGroups";
|
private static final String TOP_GROUPS = "topGroups";
|
||||||
|
@ -47,6 +48,7 @@ public class SearchGroupsResultTransformer implements ShardResultTransformer<Lis
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public NamedList transform(List<Command> data) throws IOException {
|
public NamedList transform(List<Command> data) throws IOException {
|
||||||
final NamedList<NamedList> result = new NamedList<>(data.size());
|
final NamedList<NamedList> result = new NamedList<>(data.size());
|
||||||
for (Command command : data) {
|
for (Command command : data) {
|
||||||
|
@ -71,6 +73,7 @@ public class SearchGroupsResultTransformer implements ShardResultTransformer<Lis
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private SearchGroup<BytesRef> deserializeOneSearchGroup(SchemaField groupField, String groupValue,
|
private SearchGroup<BytesRef> deserializeOneSearchGroup(SchemaField groupField, String groupValue,
|
||||||
SortField[] groupSortField, List<Comparable> rawSearchGroupData) {
|
SortField[] groupSortField, List<Comparable> rawSearchGroupData) {
|
||||||
SearchGroup<BytesRef> searchGroup = new SearchGroup<>();
|
SearchGroup<BytesRef> searchGroup = new SearchGroup<>();
|
||||||
|
@ -93,12 +96,13 @@ public class SearchGroupsResultTransformer implements ShardResultTransformer<Lis
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public Map<String, SearchGroupsFieldCommandResult> transformToNative(NamedList<NamedList> shardResponse, Sort groupSort, Sort withinGroupSort, String shard) {
|
public Map<String, SearchGroupsFieldCommandResult> transformToNative(NamedList<NamedList> shardResponse, Sort groupSort, Sort withinGroupSort, String shard) {
|
||||||
final Map<String, SearchGroupsFieldCommandResult> result = new HashMap<>(shardResponse.size());
|
final Map<String, SearchGroupsFieldCommandResult> result = new HashMap<>(shardResponse.size());
|
||||||
for (Map.Entry<String, NamedList> command : shardResponse) {
|
for (Map.Entry<String, NamedList> command : shardResponse) {
|
||||||
List<SearchGroup<BytesRef>> searchGroups = new ArrayList<>();
|
List<SearchGroup<BytesRef>> searchGroups = new ArrayList<>();
|
||||||
NamedList topGroupsAndGroupCount = command.getValue();
|
NamedList topGroupsAndGroupCount = command.getValue();
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked"})
|
||||||
final NamedList<List<Comparable>> rawSearchGroups = (NamedList<List<Comparable>>) topGroupsAndGroupCount.get(TOP_GROUPS);
|
final NamedList<List<Comparable>> rawSearchGroups = (NamedList<List<Comparable>>) topGroupsAndGroupCount.get(TOP_GROUPS);
|
||||||
if (rawSearchGroups != null) {
|
if (rawSearchGroups != null) {
|
||||||
final SchemaField groupField = searcher.getSchema().getFieldOrNull(command.getKey());
|
final SchemaField groupField = searcher.getSchema().getFieldOrNull(command.getKey());
|
||||||
|
@ -128,6 +132,7 @@ public class SearchGroupsResultTransformer implements ShardResultTransformer<Lis
|
||||||
return convertedSortValues;
|
return convertedSortValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private NamedList serializeSearchGroup(Collection<SearchGroup<BytesRef>> data, SearchGroupsFieldCommand command) {
|
private NamedList serializeSearchGroup(Collection<SearchGroup<BytesRef>> data, SearchGroupsFieldCommand command) {
|
||||||
final NamedList<Object[]> result = new NamedList<>(data.size());
|
final NamedList<Object[]> result = new NamedList<>(data.size());
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ public interface ShardResultTransformer<T, R> {
|
||||||
* @return {@link NamedList} structure
|
* @return {@link NamedList} structure
|
||||||
* @throws IOException If I/O related errors occur during transforming
|
* @throws IOException If I/O related errors occur during transforming
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList transform(T data) throws IOException;
|
NamedList transform(T data) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,6 +49,7 @@ public interface ShardResultTransformer<T, R> {
|
||||||
* @param shard The shard address where the response originated from
|
* @param shard The shard address where the response originated from
|
||||||
* @return native structure of the data
|
* @return native structure of the data
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
R transformToNative(NamedList<NamedList> shardResponse, Sort groupSort, Sort withinGroupSort, String shard);
|
R transformToNative(NamedList<NamedList> shardResponse, Sort groupSort, Sort withinGroupSort, String shard);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ import static org.apache.solr.common.params.CommonParams.ID;
|
||||||
* Implementation for transforming {@link TopGroups} and {@link TopDocs} into a {@link NamedList} structure and
|
* Implementation for transforming {@link TopGroups} and {@link TopDocs} into a {@link NamedList} structure and
|
||||||
* vice versa.
|
* vice versa.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public class TopGroupsResultTransformer implements ShardResultTransformer<List<Command>, Map<String, ?>> {
|
public class TopGroupsResultTransformer implements ShardResultTransformer<List<Command>, Map<String, ?>> {
|
||||||
|
|
||||||
private final ResponseBuilder rb;
|
private final ResponseBuilder rb;
|
||||||
|
@ -138,7 +139,7 @@ public class TopGroupsResultTransformer implements ShardResultTransformer<List<C
|
||||||
groupDocs.add(new GroupDocs<>(Float.NaN, maxScore, new TotalHits(totalGroupHits.longValue(), TotalHits.Relation.EQUAL_TO), scoreDocs, groupValueRef, null));
|
groupDocs.add(new GroupDocs<>(Float.NaN, maxScore, new TotalHits(totalGroupHits.longValue(), TotalHits.Relation.EQUAL_TO), scoreDocs, groupValueRef, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked"})
|
||||||
GroupDocs<BytesRef>[] groupDocsArr = groupDocs.toArray(new GroupDocs[groupDocs.size()]);
|
GroupDocs<BytesRef>[] groupDocsArr = groupDocs.toArray(new GroupDocs[groupDocs.size()]);
|
||||||
TopGroups<BytesRef> topGroups = new TopGroups<>(
|
TopGroups<BytesRef> topGroups = new TopGroups<>(
|
||||||
groupSort.getSort(), withinGroupSort.getSort(), totalHitCount, totalGroupedHitCount, groupDocsArr, Float.NaN
|
groupSort.getSort(), withinGroupSort.getSort(), totalHitCount, totalGroupedHitCount, groupDocsArr, Float.NaN
|
||||||
|
|
|
@ -68,6 +68,7 @@ public class GroupedEndResultTransformer implements EndResultTransformer {
|
||||||
command.add("ngroups", totalGroupCount);
|
command.add("ngroups", totalGroupCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List<NamedList> groups = new ArrayList<>();
|
List<NamedList> groups = new ArrayList<>();
|
||||||
SchemaField groupField = searcher.getSchema().getField(entry.getKey());
|
SchemaField groupField = searcher.getSchema().getField(entry.getKey());
|
||||||
FieldType groupFieldType = groupField.getType();
|
FieldType groupFieldType = groupField.getType();
|
||||||
|
|
|
@ -45,11 +45,11 @@ public class XCJFQParserPlugin extends QParserPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
@SuppressWarnings({"unchecked"})
|
||||||
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
routerField = (String) args.get("routerField");
|
routerField = (String) args.get("routerField");
|
||||||
solrUrlWhitelist = new HashSet<>();
|
solrUrlWhitelist = new HashSet<>();
|
||||||
if (args.get("solrUrl") != null) {
|
if (args.get("solrUrl") != null) {
|
||||||
//noinspection unchecked
|
|
||||||
for (String s : (List<String>) args.get("solrUrl")) {
|
for (String s : (List<String>) args.get("solrUrl")) {
|
||||||
if (!StringUtils.isEmpty(s))
|
if (!StringUtils.isEmpty(s))
|
||||||
solrUrlWhitelist.add(s);
|
solrUrlWhitelist.add(s);
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class CloudMLTQParser extends QParser {
|
||||||
String[] fieldNames;
|
String[] fieldNames;
|
||||||
|
|
||||||
if (qf != null) {
|
if (qf != null) {
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
ArrayList<String> fields = new ArrayList();
|
ArrayList<String> fields = new ArrayList();
|
||||||
for (String fieldName : qf) {
|
for (String fieldName : qf) {
|
||||||
if (!StringUtils.isEmpty(fieldName)) {
|
if (!StringUtils.isEmpty(fieldName)) {
|
||||||
|
@ -106,6 +107,7 @@ public class CloudMLTQParser extends QParser {
|
||||||
boostFields = SolrPluginUtils.parseFieldBoosts(fields.toArray(new String[0]));
|
boostFields = SolrPluginUtils.parseFieldBoosts(fields.toArray(new String[0]));
|
||||||
fieldNames = boostFields.keySet().toArray(new String[0]);
|
fieldNames = boostFields.keySet().toArray(new String[0]);
|
||||||
} else {
|
} else {
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
ArrayList<String> fields = new ArrayList();
|
ArrayList<String> fields = new ArrayList();
|
||||||
for (String field : doc.getFieldNames()) {
|
for (String field : doc.getFieldNames()) {
|
||||||
// Only use fields that are stored and have an explicit analyzer.
|
// Only use fields that are stored and have an explicit analyzer.
|
||||||
|
@ -128,6 +130,7 @@ public class CloudMLTQParser extends QParser {
|
||||||
for (String field : fieldNames) {
|
for (String field : fieldNames) {
|
||||||
Collection<Object> fieldValues = doc.getFieldValues(field);
|
Collection<Object> fieldValues = doc.getFieldValues(field);
|
||||||
if (fieldValues != null) {
|
if (fieldValues != null) {
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
Collection<Object> values = new ArrayList();
|
Collection<Object> values = new ArrayList();
|
||||||
for (Object val : fieldValues) {
|
for (Object val : fieldValues) {
|
||||||
if (val instanceof IndexableField) {
|
if (val instanceof IndexableField) {
|
||||||
|
@ -187,6 +190,7 @@ public class CloudMLTQParser extends QParser {
|
||||||
};
|
};
|
||||||
|
|
||||||
core.getRequestHandler("/get").handleRequest(request, rsp);
|
core.getRequestHandler("/get").handleRequest(request, rsp);
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList response = rsp.getValues();
|
NamedList response = rsp.getValues();
|
||||||
|
|
||||||
return (SolrDocument) response.get("doc");
|
return (SolrDocument) response.get("doc");
|
||||||
|
|
|
@ -99,6 +99,7 @@ public class SimpleMLTQParser extends QParser {
|
||||||
fieldNames = boostFields.keySet().toArray(new String[0]);
|
fieldNames = boostFields.keySet().toArray(new String[0]);
|
||||||
} else {
|
} else {
|
||||||
Map<String, SchemaField> fieldDefinitions = req.getSearcher().getSchema().getFields();
|
Map<String, SchemaField> fieldDefinitions = req.getSearcher().getSchema().getFields();
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
ArrayList<String> fields = new ArrayList();
|
ArrayList<String> fields = new ArrayList();
|
||||||
for (Map.Entry<String, SchemaField> entry : fieldDefinitions.entrySet()) {
|
for (Map.Entry<String, SchemaField> entry : fieldDefinitions.entrySet()) {
|
||||||
if (entry.getValue().indexed() && entry.getValue().stored())
|
if (entry.getValue().indexed() && entry.getValue().stored())
|
||||||
|
|
|
@ -70,7 +70,9 @@ public class ExactStatsCache extends StatsCache {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected StatsSource doGet(SolrQueryRequest req) {
|
protected StatsSource doGet(SolrQueryRequest req) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Map<String,CollectionStats> currentGlobalColStats = (Map<String,CollectionStats>) req.getContext().getOrDefault(CURRENT_GLOBAL_COL_STATS, Collections.emptyMap());
|
Map<String,CollectionStats> currentGlobalColStats = (Map<String,CollectionStats>) req.getContext().getOrDefault(CURRENT_GLOBAL_COL_STATS, Collections.emptyMap());
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Map<String,TermStats> currentGlobalTermStats = (Map<String,TermStats>) req.getContext().getOrDefault(CURRENT_GLOBAL_TERM_STATS, Collections.emptyMap());
|
Map<String,TermStats> currentGlobalTermStats = (Map<String,TermStats>) req.getContext().getOrDefault(CURRENT_GLOBAL_TERM_STATS, Collections.emptyMap());
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Returning StatsSource. Collection stats={}, Term stats size= {}", currentGlobalColStats, currentGlobalTermStats.size());
|
log.debug("Returning StatsSource. Collection stats={}, Term stats size= {}", currentGlobalColStats, currentGlobalTermStats.size());
|
||||||
|
@ -127,12 +129,15 @@ public class ExactStatsCache extends StatsCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addToPerShardColStats(SolrQueryRequest req, String shard, Map<String,CollectionStats> colStats) {
|
protected void addToPerShardColStats(SolrQueryRequest req, String shard, Map<String,CollectionStats> colStats) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Map<String,Map<String,CollectionStats>> perShardColStats = (Map<String,Map<String,CollectionStats>>) req.getContext().computeIfAbsent(PER_SHARD_COL_STATS, Utils.NEW_HASHMAP_FUN);
|
Map<String,Map<String,CollectionStats>> perShardColStats = (Map<String,Map<String,CollectionStats>>) req.getContext().computeIfAbsent(PER_SHARD_COL_STATS, Utils.NEW_HASHMAP_FUN);
|
||||||
perShardColStats.put(shard, colStats);
|
perShardColStats.put(shard, colStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void printStats(SolrQueryRequest req) {
|
protected void printStats(SolrQueryRequest req) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Map<String,Map<String,TermStats>> perShardTermStats = (Map<String,Map<String,TermStats>>) req.getContext().getOrDefault(PER_SHARD_TERM_STATS, Collections.emptyMap());
|
Map<String,Map<String,TermStats>> perShardTermStats = (Map<String,Map<String,TermStats>>) req.getContext().getOrDefault(PER_SHARD_TERM_STATS, Collections.emptyMap());
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Map<String,Map<String,CollectionStats>> perShardColStats = (Map<String,Map<String,CollectionStats>>) req.getContext().getOrDefault(PER_SHARD_COL_STATS, Collections.emptyMap());
|
Map<String,Map<String,CollectionStats>> perShardColStats = (Map<String,Map<String,CollectionStats>>) req.getContext().getOrDefault(PER_SHARD_COL_STATS, Collections.emptyMap());
|
||||||
log.debug("perShardColStats={}, perShardTermStats={}", perShardColStats, perShardTermStats);
|
log.debug("perShardColStats={}, perShardTermStats={}", perShardColStats, perShardTermStats);
|
||||||
}
|
}
|
||||||
|
@ -140,6 +145,7 @@ public class ExactStatsCache extends StatsCache {
|
||||||
protected void addToPerShardTermStats(SolrQueryRequest req, String shard, String termStatsString) {
|
protected void addToPerShardTermStats(SolrQueryRequest req, String shard, String termStatsString) {
|
||||||
Map<String,TermStats> termStats = StatsUtil.termStatsMapFromString(termStatsString);
|
Map<String,TermStats> termStats = StatsUtil.termStatsMapFromString(termStatsString);
|
||||||
if (termStats != null) {
|
if (termStats != null) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Map<String,Map<String,TermStats>> perShardTermStats = (Map<String,Map<String,TermStats>>) req.getContext().computeIfAbsent(PER_SHARD_TERM_STATS, Utils.NEW_HASHMAP_FUN);
|
Map<String,Map<String,TermStats>> perShardTermStats = (Map<String,Map<String,TermStats>>) req.getContext().computeIfAbsent(PER_SHARD_TERM_STATS, Utils.NEW_HASHMAP_FUN);
|
||||||
perShardTermStats.put(shard, termStats);
|
perShardTermStats.put(shard, termStats);
|
||||||
}
|
}
|
||||||
|
@ -275,11 +281,13 @@ public class ExactStatsCache extends StatsCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String,CollectionStats> getPerShardColStats(ResponseBuilder rb, String shard) {
|
protected Map<String,CollectionStats> getPerShardColStats(ResponseBuilder rb, String shard) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Map<String,Map<String,CollectionStats>> perShardColStats = (Map<String,Map<String,CollectionStats>>) rb.req.getContext().getOrDefault(PER_SHARD_COL_STATS, Collections.emptyMap());
|
Map<String,Map<String,CollectionStats>> perShardColStats = (Map<String,Map<String,CollectionStats>>) rb.req.getContext().getOrDefault(PER_SHARD_COL_STATS, Collections.emptyMap());
|
||||||
return perShardColStats.get(shard);
|
return perShardColStats.get(shard);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TermStats getPerShardTermStats(SolrQueryRequest req, String t, String shard) {
|
protected TermStats getPerShardTermStats(SolrQueryRequest req, String t, String shard) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Map<String,Map<String,TermStats>> perShardTermStats = (Map<String,Map<String,TermStats>>) req.getContext().getOrDefault(PER_SHARD_TERM_STATS, Collections.emptyMap());
|
Map<String,Map<String,TermStats>> perShardTermStats = (Map<String,Map<String,TermStats>>) req.getContext().getOrDefault(PER_SHARD_TERM_STATS, Collections.emptyMap());
|
||||||
Map<String,TermStats> cache = perShardTermStats.get(shard);
|
Map<String,TermStats> cache = perShardTermStats.get(shard);
|
||||||
return (cache != null) ? cache.get(t) : null; //Term doesn't exist in shard
|
return (cache != null) ? cache.get(t) : null; //Term doesn't exist in shard
|
||||||
|
@ -309,11 +317,13 @@ public class ExactStatsCache extends StatsCache {
|
||||||
|
|
||||||
protected void addToGlobalColStats(SolrQueryRequest req,
|
protected void addToGlobalColStats(SolrQueryRequest req,
|
||||||
Entry<String,CollectionStats> e) {
|
Entry<String,CollectionStats> e) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Map<String,CollectionStats> currentGlobalColStats = (Map<String,CollectionStats>) req.getContext().computeIfAbsent(CURRENT_GLOBAL_COL_STATS, Utils.NEW_HASHMAP_FUN);
|
Map<String,CollectionStats> currentGlobalColStats = (Map<String,CollectionStats>) req.getContext().computeIfAbsent(CURRENT_GLOBAL_COL_STATS, Utils.NEW_HASHMAP_FUN);
|
||||||
currentGlobalColStats.put(e.getKey(), e.getValue());
|
currentGlobalColStats.put(e.getKey(), e.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addToGlobalTermStats(SolrQueryRequest req, Entry<String,TermStats> e) {
|
protected void addToGlobalTermStats(SolrQueryRequest req, Entry<String,TermStats> e) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Map<String,TermStats> currentGlobalTermStats = (Map<String,TermStats>) req.getContext().computeIfAbsent(CURRENT_GLOBAL_TERM_STATS, Utils.NEW_HASHMAP_FUN);
|
Map<String,TermStats> currentGlobalTermStats = (Map<String,TermStats>) req.getContext().computeIfAbsent(CURRENT_GLOBAL_TERM_STATS, Utils.NEW_HASHMAP_FUN);
|
||||||
currentGlobalTermStats.put(e.getKey(), e.getValue());
|
currentGlobalTermStats.put(e.getKey(), e.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,9 @@ public class LRUStatsCache extends ExactStatsCache {
|
||||||
protected void addToPerShardTermStats(SolrQueryRequest req, String shard, String termStatsString) {
|
protected void addToPerShardTermStats(SolrQueryRequest req, String shard, String termStatsString) {
|
||||||
Map<String,TermStats> termStats = StatsUtil.termStatsMapFromString(termStatsString);
|
Map<String,TermStats> termStats = StatsUtil.termStatsMapFromString(termStatsString);
|
||||||
if (termStats != null) {
|
if (termStats != null) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
SolrCache<String,TermStats> cache = perShardTermStats.computeIfAbsent(shard, s -> {
|
SolrCache<String,TermStats> cache = perShardTermStats.computeIfAbsent(shard, s -> {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
CaffeineCache c = new CaffeineCache<>();
|
CaffeineCache c = new CaffeineCache<>();
|
||||||
Map<String, String> map = new HashMap<>(lruCacheInitArgs);
|
Map<String, String> map = new HashMap<>(lruCacheInitArgs);
|
||||||
map.put(CommonParams.NAME, s);
|
map.put(CommonParams.NAME, s);
|
||||||
|
|
Loading…
Reference in New Issue