/** * Removes and returns all values for the specified name. Returns null if * no matches found. This method will return all matching objects, * regardless of data type. If you are parsing Solr config options, the * {@link #removeConfigArgs(String)} or {@link #removeBooleanArg(String)} * methods will probably work better. * * @param name Name * @return List of values */ public List<T> removeAll(String name) { List<T> result = new ArrayList<>(); result = getAll(name); if (result.size() > 0 ) { killAll(name); return result; } return null; }
/** * Removes and returns all values for the specified name. Returns null if * no matches found. This method will return all matching objects, * regardless of data type. If you are parsing Solr config options, the * {@link #removeConfigArgs(String)} or {@link #removeBooleanArg(String)} * methods will probably work better. * * @param name Name * @return List of values */ public List<T> removeAll(String name) { List<T> result = new ArrayList<>(); result = getAll(name); if (result.size() > 0 ) { killAll(name); return result; } return null; }
@Override public void init( NamedList args){ String fullPrefix = getPrefix() + "."; List<String> lFields = args.getAll(fullPrefix + JointProbabilityParams.FIELDS); if(lFields.size() > 0){ this.fields = lFields.toArray(new String[lFields.size()]); } Object oFreq = args.get(fullPrefix + JointProbabilityParams.MIN_COUNT); if(oFreq != null && oFreq instanceof Integer){ this.dfltMinCount = (Integer)oFreq; } Object oLimit = args.get(fullPrefix + JointProbabilityParams.LIMIT); if(oLimit != null && oLimit instanceof Integer){ this.dfltLimit = (Integer)oLimit; } }
private boolean hasErrors(UpdateResponse response) { if (response.getStatus() != 0 || response.getResponse() != null && !CollectionUtils.isEmpty(response.getResponse().getAll("errors"))) { return true; } return false; }
private FieldMapper parseDefaultMapping(NamedList args) { List defaultParams = args.getAll(DEFAULT_PARAM); if (defaultParams.size() > 1) { throw new SolrException(SERVER_ERROR, "Only one '" + DEFAULT_PARAM + "' mapping is allowed"); } FieldMapper mapper = null; if (!defaultParams.isEmpty()) { NamedList defaultMappingNamedList = this.validateParameter(DEFAULT_PARAM, defaultParams.get(0)); String fieldType = this.parseFieldTypeParameter(defaultMappingNamedList); mapper = new DefaultFieldMapper(fieldType); args.remove(DEFAULT_PARAM); } return mapper; }
List<T> values = getAll(name); if (0 == values.size()) { return null;
private FieldMapper parseJsonMapping(NamedList args) { List jsonParams = args.getAll(JSON_PARAM); if (jsonParams.size() > 1) { throw new SolrException(SERVER_ERROR, "Only one '" + JSON_PARAM + "' mapping is allowed"); } FieldMapper mapper = null; if (!jsonParams.isEmpty()) { NamedList jsonMappingNamedList = this.validateParameter(JSON_PARAM, jsonParams.get(0)); String fieldType = this.parseFieldTypeParameter(jsonMappingNamedList); mapper = new JsonFieldMapper(fieldType); args.remove(JSON_PARAM); } return mapper; }
List<T> values = getAll(name); if (0 == values.size()) { return null;
public Collection<String> removeConfigArgs(final String name) throws SolrException { List<T> objects = getAll(name); List<String> collection = new ArrayList<>(size() / 2); final String err = "init arg '" + name + "' must be a string "
Strategy.parse((String)args.get(SuggestionRequestParams.SUGGESTION_STRATEGY), STRATEGY) :STRATEGY; List<String> fields = args.getAll(SuggestionRequestParams.SUGGESTION_FIELD) != null ? args.getAll(SuggestionRequestParams.SUGGESTION_FIELD) : Collections.emptyList(); if(!fields.isEmpty()) { FIELDS = fields.toArray(new String[fields.size()]); List<String> multivalue_fields = args.getAll(SuggestionRequestParams.SUGGESTION_MULTIVALUE_FIELD) != null ? args.getAll(SuggestionRequestParams.SUGGESTION_MULTIVALUE_FIELD) : Collections.emptyList(); if(!multivalue_fields.isEmpty()) { MULTIVALUE_FIELDS = fields.toArray(new String[multivalue_fields.size()]); List<String> fqs = args.getAll(CommonParams.FQ) != null ? args.getAll(CommonParams.FQ) : Collections.emptyList(); if(!fqs.isEmpty()) { FQS = fqs.toArray(new String[fields.size()]);
public Collection<String> removeConfigArgs(final String name) throws SolrException { List<T> objects = getAll(name); List<String> collection = new ArrayList<>(size() / 2); final String err = "init arg '" + name + "' must be a string "
/** * Loads the whole {@link RewriteChain}s from the args and returns a list of * them. */ private RewriteChain loadRewriteChain(final ResourceLoader loader) throws IOException { final NamedList<?> chainConfig = (NamedList<?>) initArgs.get("rewriteChain"); final List<RewriterFactory> factories = new LinkedList<>(); if (chainConfig != null) { @SuppressWarnings("unchecked") final List<NamedList<?>> rewriterConfigs = (List<NamedList<?>>) chainConfig.getAll("rewriter"); if (rewriterConfigs != null) { for (NamedList<?> config : rewriterConfigs) { RewriterFactoryAdapter factory = loader.newInstance((String) config.get("class"), RewriterFactoryAdapter.class); factories.add(factory.createRewriterFactory(config, loader)); } } } return new RewriteChain(factories); }
List<String> errors = response.getValues().getAll("xpath-error"); String contentType = getContentType (request, response); NamedList<?> values = (NamedList<?>) response.getValues().get("xpath-results");
private List<FieldMapper> parseMappings(NamedList args, String paramName) { List<FieldMapper> mappers = new ArrayList<>(); List params = args.getAll(paramName); if (!params.isEmpty()) { for (Object mapping : params) { NamedList mappingNamedList = this.validateParameter(paramName, mapping); String fieldType = this.parseFieldTypeParameter(mappingNamedList); String path = this.parseStringParameter(mappingNamedList, PATH_PARAM); String type = this.parseStringParameter(mappingNamedList, TYPE_PARAM); if ((path == null && type == null) || (path != null && type != null)) { throw new SolrException(SERVER_ERROR, "Each mapping must contain either a '" + PATH_PARAM + "' or a '" + TYPE_PARAM + "' sub-parameter"); } if (mappingNamedList.size() != 0) { throw new SolrException(SERVER_ERROR, "Unexpected '" + paramName + "' sub-parameter(s): '" + mappingNamedList.toString() + "'"); } if (path == null) { mappers.add(new TypeFieldMapper(type, fieldType)); } else { mappers.add(new PathFieldMapper(path, fieldType)); } } args.remove(paramName); } return mappers; }
if (coll != null) { List<Object> collationInfo = coll.getAll("collation"); collations = new ArrayList<>(collationInfo.size()); for (Object o : collationInfo) {
List backup = master.getAll("backupAfter"); boolean backupOnCommit = backup.contains("commit"); boolean backupOnOptimize = backup.contains("optimize"); List replicateAfter = master.getAll(REPLICATE_AFTER); replicateOnCommit = replicateAfter.contains("commit"); replicateOnOptimize = replicateAfter.contains("optimize");
if (coll != null) { List<Object> collationInfo = coll.getAll("collation"); collations = new ArrayList<>(collationInfo.size()); for (Object o : collationInfo) {
private List<TypeMapping> parseTypeMappings(NamedList args) { List<TypeMapping> typeMappings = new ArrayList<TypeMapping>(); List typeMappingsParams = args.getAll(TYPE_MAPPING_PARAM); for (Object typeMappingObj : typeMappingsParams) { if (null == typeMappingObj) {