http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/FacetParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/FacetParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/FacetParams.java deleted file mode 100644 index 42bd1fc..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/FacetParams.java +++ /dev/null @@ -1,405 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -import java.util.EnumSet; -import java.util.Locale; - -import org.apache.solr.common.SolrException; - -/** - * Facet parameters - */ -public interface FacetParams { - - /** - * Should facet counts be calculated? - */ - String FACET = "facet"; - - /** - * Numeric option indicating the maximum number of threads to be used - * in counting facet field vales - */ - String FACET_THREADS = FACET + ".threads"; - - /** What method should be used to do the faceting */ - String FACET_METHOD = FACET + ".method"; - - /** Value for FACET_METHOD param to indicate that Solr should enumerate over terms - * in a field to calculate the facet counts. - */ - String FACET_METHOD_enum = "enum"; - - /** Value for FACET_METHOD param to indicate that Solr should enumerate over documents - * and count up terms by consulting an uninverted representation of the field values - * (such as the FieldCache used for sorting). - */ - String FACET_METHOD_fc = "fc"; - - /** Value for FACET_METHOD param, like FACET_METHOD_fc but counts per-segment. - */ - String FACET_METHOD_fcs = "fcs"; - - /** - * Any lucene formated queries the user would like to use for - * Facet Constraint Counts (multi-value) - */ - String FACET_QUERY = FACET + ".query"; - /** - * Any field whose terms the user wants to enumerate over for - * Facet Constraint Counts (multi-value) - */ - String FACET_FIELD = FACET + ".field"; - - /** - * The offset into the list of facets. - * Can be overridden on a per field basis. - */ - String FACET_OFFSET = FACET + ".offset"; - - /** - * Numeric option indicating the maximum number of facet field counts - * be included in the response for each field - in descending order of count. - * Can be overridden on a per field basis. - */ - String FACET_LIMIT = FACET + ".limit"; - - /** - * Numeric option indicating the minimum number of hits before a facet should - * be included in the response. Can be overridden on a per field basis. - */ - String FACET_MINCOUNT = FACET + ".mincount"; - - /** - * Boolean option indicating whether facet field counts of "0" should - * be included in the response. Can be overridden on a per field basis. - */ - String FACET_ZEROS = FACET + ".zeros"; - - /** - * Boolean option indicating whether the response should include a - * facet field count for all records which have no value for the - * facet field. Can be overridden on a per field basis. - */ - String FACET_MISSING = FACET + ".missing"; - - - String FACET_OVERREQUEST = FACET + ".overrequest"; - - /** - * The percentage to over-request by when performing initial distributed requests. - * - * default value is 1.5 - */ - String FACET_OVERREQUEST_RATIO = FACET_OVERREQUEST + ".ratio"; - - /** - * An additional amount to over-request by when performing initial distributed requests. This - * value will be added after accounting for the over-request ratio. - * - * default value is 10 - */ - String FACET_OVERREQUEST_COUNT = FACET_OVERREQUEST + ".count"; - - - /** - * Comma separated list of fields to pivot - * - * example: author,type (for types by author / types within author) - */ - String FACET_PIVOT = FACET + ".pivot"; - - /** - * Minimum number of docs that need to match to be included in the sublist - * - * default value is 1 - */ - String FACET_PIVOT_MINCOUNT = FACET_PIVOT + ".mincount"; - - - /** - * String option: "count" causes facets to be sorted - * by the count, "index" results in index order. - */ - String FACET_SORT = FACET + ".sort"; - - String FACET_SORT_COUNT = "count"; - String FACET_SORT_COUNT_LEGACY = "true"; - String FACET_SORT_INDEX = "index"; - String FACET_SORT_INDEX_LEGACY = "false"; - - /** - * Only return constraints of a facet field with the given prefix. - */ - String FACET_PREFIX = FACET + ".prefix"; - - /** - * When faceting by enumerating the terms in a field, - * only use the filterCache for terms with a df >= to this parameter. - */ - String FACET_ENUM_CACHE_MINDF = FACET + ".enum.cache.minDf"; - /** - * Any field whose terms the user wants to enumerate over for - * Facet Contraint Counts (multi-value) - */ - String FACET_DATE = FACET + ".date"; - /** - * Date string indicating the starting point for a date facet range. - * Can be overriden on a per field basis. - */ - String FACET_DATE_START = FACET_DATE + ".start"; - /** - * Date string indicating the endinging point for a date facet range. - * Can be overriden on a per field basis. - */ - String FACET_DATE_END = FACET_DATE + ".end"; - /** - * Date Math string indicating the interval of sub-ranges for a date - * facet range. - * Can be overriden on a per field basis. - */ - String FACET_DATE_GAP = FACET_DATE + ".gap"; - /** - * Boolean indicating how counts should be computed if the range - * between 'start' and 'end' is not evenly divisible by 'gap'. If - * this value is true, then all counts of ranges involving the 'end' - * point will use the exact endpoint specified -- this includes the - * 'between' and 'after' counts as well as the last range computed - * using the 'gap'. If the value is false, then 'gap' is used to - * compute the effective endpoint closest to the 'end' param which - * results in the range between 'start' and 'end' being evenly - * divisible by 'gap'. - * The default is false. - * Can be overriden on a per field basis. - */ - String FACET_DATE_HARD_END = FACET_DATE + ".hardend"; - /** - * String indicating what "other" ranges should be computed for a - * date facet range (multi-value). - * Can be overriden on a per field basis. - * @see FacetRangeOther - */ - String FACET_DATE_OTHER = FACET_DATE + ".other"; - - /** - * <p> - * Multivalued string indicating what rules should be applied to determine - * when the the ranges generated for date faceting should be inclusive or - * exclusive of their end points. - * </p> - * <p> - * The default value if none are specified is: [lower,upper,edge] <i>(NOTE: This is different then FACET_RANGE_INCLUDE)</i> - * </p> - * <p> - * Can be overriden on a per field basis. - * </p> - * @see FacetRangeInclude - * @see #FACET_RANGE_INCLUDE - */ - String FACET_DATE_INCLUDE = FACET_DATE + ".include"; - - /** - * Any numerical field whose terms the user wants to enumerate over - * Facet Contraint Counts for selected ranges. - */ - String FACET_RANGE = FACET + ".range"; - /** - * Number indicating the starting point for a numerical range facet. - * Can be overriden on a per field basis. - */ - String FACET_RANGE_START = FACET_RANGE + ".start"; - /** - * Number indicating the ending point for a numerical range facet. - * Can be overriden on a per field basis. - */ - String FACET_RANGE_END = FACET_RANGE + ".end"; - /** - * Number indicating the interval of sub-ranges for a numerical - * facet range. - * Can be overriden on a per field basis. - */ - String FACET_RANGE_GAP = FACET_RANGE + ".gap"; - /** - * Boolean indicating how counts should be computed if the range - * between 'start' and 'end' is not evenly divisible by 'gap'. If - * this value is true, then all counts of ranges involving the 'end' - * point will use the exact endpoint specified -- this includes the - * 'between' and 'after' counts as well as the last range computed - * using the 'gap'. If the value is false, then 'gap' is used to - * compute the effective endpoint closest to the 'end' param which - * results in the range between 'start' and 'end' being evenly - * divisible by 'gap'. - * The default is false. - * Can be overriden on a per field basis. - */ - String FACET_RANGE_HARD_END = FACET_RANGE + ".hardend"; - /** - * String indicating what "other" ranges should be computed for a - * numerical range facet (multi-value). - * Can be overriden on a per field basis. - */ - String FACET_RANGE_OTHER = FACET_RANGE + ".other"; - - /** - * <p> - * Multivalued string indicating what rules should be applied to determine - * when the the ranges generated for numeric faceting should be inclusive or - * exclusive of their end points. - * </p> - * <p> - * The default value if none are specified is: lower - * </p> - * <p> - * Can be overriden on a per field basis. - * </p> - * @see FacetRangeInclude - */ - String FACET_RANGE_INCLUDE = FACET_RANGE + ".include"; - - /** - * Any field whose values the user wants to enumerate as explicit intervals of terms. - */ - String FACET_INTERVAL = FACET + ".interval"; - - /** - * Set of terms for a single interval to facet on. - */ - String FACET_INTERVAL_SET = FACET_INTERVAL + ".set"; - - /** A spatial RPT field to generate a 2D "heatmap" (grid of facet counts) on. Just like the other faceting types, - * this may include a 'key' or local-params to facet multiple times. All parameters with this suffix can be - * overridden on a per-field basis. */ - String FACET_HEATMAP = "facet.heatmap"; - - /** The format of the heatmap: either png or ints2D (default). */ - String FACET_HEATMAP_FORMAT = FACET_HEATMAP + ".format"; - - /** The region the heatmap should minimally enclose. It defaults to the world if not set. The format can either be - * a minimum to maximum point range format: <pre>["-150 10" TO "-100 30"]</pre> (the first is bottom-left and second - * is bottom-right, both of which are parsed as points are parsed). OR, any WKT can be provided and it's bounding - * box will be taken. */ - String FACET_HEATMAP_GEOM = FACET_HEATMAP + ".geom"; - - /** Specify the heatmap grid level explicitly, instead of deriving it via distErr or distErrPct. */ - String FACET_HEATMAP_LEVEL = FACET_HEATMAP + ".gridLevel"; - - /** Used to determine the heatmap grid level to compute, defaulting to 0.15. It has the same interpretation of - * distErrPct when searching on RPT, but relative to the shape in 'bbox'. It's a fraction (not a %) of the radius of - * the shape that grid squares must fit into without exceeding. > 0 and <= 0.5. - * Mutually exclusive with distErr & gridLevel. */ - String FACET_HEATMAP_DIST_ERR_PCT = FACET_HEATMAP + ".distErrPct"; - - /** Used to determine the heatmap grid level to compute (optional). It has the same interpretation of maxDistErr or - * distErr with RPT. It's an absolute distance (in units of what's specified on the field type) that a grid square - * must maximally fit into (width & height). It can be used to to more explicitly specify the maximum grid square - * size without knowledge of what particular grid levels translate to. This can in turn be used with - * knowledge of the size of 'bbox' to get a target minimum number of grid cells. - * Mutually exclusive with distErrPct & gridLevel. */ - String FACET_HEATMAP_DIST_ERR = FACET_HEATMAP + ".distErr"; - - /** The maximum number of cells (grid squares) the client is willing to handle. If this limit would be exceeded, we - * throw an error instead. Defaults to 100k. */ - String FACET_HEATMAP_MAX_CELLS = FACET_HEATMAP + ".maxCells"; - - /** - * An enumeration of the legal values for {@link #FACET_RANGE_OTHER} and {@link #FACET_DATE_OTHER} ... - * <ul> - * <li>before = the count of matches before the start</li> - * <li>after = the count of matches after the end</li> - * <li>between = the count of all matches between start and end</li> - * <li>all = all of the above (default value)</li> - * <li>none = no additional info requested</li> - * </ul> - * @see #FACET_RANGE_OTHER - * @see #FACET_DATE_OTHER - */ - public enum FacetRangeOther { - BEFORE, AFTER, BETWEEN, ALL, NONE; - @Override - public String toString() { return super.toString().toLowerCase(Locale.ROOT); } - public static FacetRangeOther get(String label) { - try { - return valueOf(label.toUpperCase(Locale.ROOT)); - } catch (IllegalArgumentException e) { - throw new SolrException - (SolrException.ErrorCode.BAD_REQUEST, - label+" is not a valid type of 'other' range facet information",e); - } - } - } - - /** - * An enumeration of the legal values for {@link #FACET_DATE_INCLUDE} and {@link #FACET_RANGE_INCLUDE} - * <br> - * <ul> - * <li>lower = all gap based ranges include their lower bound</li> - * <li>upper = all gap based ranges include their upper bound</li> - * <li>edge = the first and last gap ranges include their edge bounds (ie: lower - * for the first one, upper for the last one) even if the corresponding - * upper/lower option is not specified - * </li> - * <li>outer = the BEFORE and AFTER ranges - * should be inclusive of their bounds, even if the first or last ranges - * already include those boundaries. - * </li> - * <li>all = shorthand for lower, upper, edge, and outer</li> - * </ul> - * @see #FACET_DATE_INCLUDE - * @see #FACET_RANGE_INCLUDE - */ - public enum FacetRangeInclude { - ALL, LOWER, UPPER, EDGE, OUTER; - @Override - public String toString() { return super.toString().toLowerCase(Locale.ROOT); } - public static FacetRangeInclude get(String label) { - try { - return valueOf(label.toUpperCase(Locale.ROOT)); - } catch (IllegalArgumentException e) { - throw new SolrException - (SolrException.ErrorCode.BAD_REQUEST, - label+" is not a valid type of for range 'include' information",e); - } - } - /** - * Convinience method for parsing the param value according to the - * correct semantics and applying the default of "LOWER" - */ - public static EnumSet<FacetRangeInclude> parseParam(final String[] param) { - // short circut for default behavior - if (null == param || 0 == param.length ) - return EnumSet.of(LOWER); - - // build up set containing whatever is specified - final EnumSet<FacetRangeInclude> include - = EnumSet.noneOf(FacetRangeInclude.class); - for (final String o : param) { - include.add(FacetRangeInclude.get(o)); - } - - // if set contains all, then we're back to short circuting - if (include.contains(FacetRangeInclude.ALL)) - return EnumSet.allOf(FacetRangeInclude.class); - - // use whatever we've got. - return include; - } - } - -} -
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/GroupParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/GroupParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/GroupParams.java deleted file mode 100644 index 36f11cf..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/GroupParams.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -/** - * Group parameters - */ -public interface GroupParams { - String GROUP = "group"; - - String GROUP_QUERY = GROUP + ".query"; - String GROUP_FIELD = GROUP + ".field"; - String GROUP_FUNC = GROUP + ".func"; - String GROUP_SORT = GROUP + ".sort"; - - /** the limit for the number of documents in each group */ - String GROUP_LIMIT = GROUP + ".limit"; - /** the offset for the doclist of each group */ - String GROUP_OFFSET = GROUP + ".offset"; - - /** treat the first group result as the main result. true/false */ - String GROUP_MAIN = GROUP + ".main"; - - /** treat the first group result as the main result. true/false */ - String GROUP_FORMAT = GROUP + ".format"; - - /** - * Whether to cache the first pass search (doc ids and score) for the second pass search. - * Also defines the maximum size of the group cache relative to maxdoc in a percentage. - * Values can be a positive integer, from 0 till 100. A value of 0 will disable the group cache. - * The default is 0.*/ - String GROUP_CACHE_PERCENTAGE = GROUP + ".cache.percent"; - - // Note: Since you can supply multiple fields to group on, but only have a facets for the whole result. It only makes - // sense to me to support these parameters for the first group. - /** Whether the docSet (for example for faceting) should be based on plain documents (a.k.a UNGROUPED) or on the groups (a.k.a GROUPED). - * The docSet will only the most relevant documents per group. It is if you query for everything with group.limit=1 */ - String GROUP_TRUNCATE = GROUP + ".truncate"; - - /** Whether the group count should be included in the response. */ - String GROUP_TOTAL_COUNT = GROUP + ".ngroups"; - - /** Whether to compute grouped facets based on the first specified group. */ - String GROUP_FACET = GROUP + ".facet"; - - /** Retrieve the top search groups (top group values) from the shards being queried. */ - String GROUP_DISTRIBUTED_FIRST = GROUP + ".distributed.first"; - - /** Retrieve the top groups from the shards being queries based on the specified search groups in - * the {@link #GROUP_DISTRIBUTED_TOPGROUPS_PREFIX} parameters. - */ - String GROUP_DISTRIBUTED_SECOND = GROUP + ".distributed.second"; - - String GROUP_DISTRIBUTED_TOPGROUPS_PREFIX = GROUP + ".topgroups."; -} - http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/HighlightParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/HighlightParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/HighlightParams.java deleted file mode 100644 index 66c2542..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/HighlightParams.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -/** - * - * @since solr 1.3 - */ -public interface HighlightParams { - String HIGHLIGHT = "hl"; - String Q = HIGHLIGHT+".q"; - String QPARSER = HIGHLIGHT+".qparser"; - String FIELDS = HIGHLIGHT+".fl"; - String SNIPPETS = HIGHLIGHT+".snippets"; - String FRAGSIZE = HIGHLIGHT+".fragsize"; - String INCREMENT = HIGHLIGHT+".increment"; - String MAX_CHARS = HIGHLIGHT+".maxAnalyzedChars"; - String FORMATTER = HIGHLIGHT+".formatter"; - String ENCODER = HIGHLIGHT+".encoder"; - String FRAGMENTER = HIGHLIGHT+".fragmenter"; - String PRESERVE_MULTI = HIGHLIGHT+".preserveMulti"; - String FRAG_LIST_BUILDER = HIGHLIGHT+".fragListBuilder"; - String FRAGMENTS_BUILDER = HIGHLIGHT+".fragmentsBuilder"; - String BOUNDARY_SCANNER = HIGHLIGHT+".boundaryScanner"; - String BS_MAX_SCAN = HIGHLIGHT+".bs.maxScan"; - String BS_CHARS = HIGHLIGHT+".bs.chars"; - String BS_TYPE = HIGHLIGHT+".bs.type"; - String BS_LANGUAGE = HIGHLIGHT+".bs.language"; - String BS_COUNTRY = HIGHLIGHT+".bs.country"; - String BS_VARIANT = HIGHLIGHT+".bs.variant"; - String FIELD_MATCH = HIGHLIGHT+".requireFieldMatch"; - String DEFAULT_SUMMARY = HIGHLIGHT + ".defaultSummary"; - String ALTERNATE_FIELD = HIGHLIGHT+".alternateField"; - String ALTERNATE_FIELD_LENGTH = HIGHLIGHT+".maxAlternateFieldLength"; - String MAX_MULTIVALUED_TO_EXAMINE = HIGHLIGHT + ".maxMultiValuedToExamine"; - String MAX_MULTIVALUED_TO_MATCH = HIGHLIGHT + ".maxMultiValuedToMatch"; - - String USE_PHRASE_HIGHLIGHTER = HIGHLIGHT+".usePhraseHighlighter"; - String HIGHLIGHT_MULTI_TERM = HIGHLIGHT+".highlightMultiTerm"; - String PAYLOADS = HIGHLIGHT+".payloads"; - - String MERGE_CONTIGUOUS_FRAGMENTS = HIGHLIGHT + ".mergeContiguous"; - - String USE_FVH = HIGHLIGHT + ".useFastVectorHighlighter"; - String TAG_PRE = HIGHLIGHT + ".tag.pre"; - String TAG_POST = HIGHLIGHT + ".tag.post"; - String TAG_ELLIPSIS = HIGHLIGHT + ".tag.ellipsis"; - String PHRASE_LIMIT = HIGHLIGHT + ".phraseLimit"; - String MULTI_VALUED_SEPARATOR = HIGHLIGHT + ".multiValuedSeparatorChar"; - - // Formatter - String SIMPLE = "simple"; - String SIMPLE_PRE = HIGHLIGHT+"."+SIMPLE+".pre"; - String SIMPLE_POST = HIGHLIGHT+"."+SIMPLE+".post"; - - // Regex fragmenter - String REGEX = "regex"; - String SLOP = HIGHLIGHT+"."+REGEX+".slop"; - String PATTERN = HIGHLIGHT+"."+REGEX+".pattern"; - String MAX_RE_CHARS = HIGHLIGHT+"."+REGEX+".maxAnalyzedChars"; - - // Scoring parameters - String SCORE = "score"; - String SCORE_K1 = HIGHLIGHT +"."+SCORE+".k1"; - String SCORE_B = HIGHLIGHT +"."+SCORE+".b"; - String SCORE_PIVOT = HIGHLIGHT +"."+SCORE+".pivot"; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/MapSolrParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/MapSolrParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/MapSolrParams.java deleted file mode 100644 index f2a1c37..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/MapSolrParams.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -import org.apache.solr.common.util.StrUtils; - -import java.util.Arrays; -import java.util.Iterator; -import java.util.Map; -import java.io.IOException; - -/** - * - */ -public class MapSolrParams extends SolrParams { - protected final Map<String,String> map; - - public MapSolrParams(Map<String,String> map) { - this.map = map; - } - - @Override - public String get(String name) { - Object o = map.get(name); - if(o == null) return null; - if (o instanceof String) return (String) o; - if (o instanceof String[]) { - String[] strings = (String[]) o; - if(strings.length == 0) return null; - return strings[0]; - } - return String.valueOf(o); - } - - @Override - public String[] getParams(String name) { - Object val = map.get(name); - if (val instanceof String[]) return (String[]) val; - return val==null ? null : new String[]{String.valueOf(val)}; - } - - @Override - public Iterator<String> getParameterNamesIterator() { - return map.keySet().iterator(); - } - - public Map<String,String> getMap() { return map; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(128); - try { - boolean first=true; - - for (Map.Entry<String,String> entry : map.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - if (val instanceof String[]) { - String[] strings = (String[]) val; - val = StrUtils.join(Arrays.asList(strings),','); - } - if (!first) sb.append('&'); - first=false; - sb.append(key); - sb.append('='); - StrUtils.partialURLEncodeVal(sb, val==null ? "" : String.valueOf(val)); - } - } - catch (IOException e) {throw new RuntimeException(e);} // can't happen - - return sb.toString(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/ModifiableSolrParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/ModifiableSolrParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/ModifiableSolrParams.java deleted file mode 100644 index b84f4aa..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/ModifiableSolrParams.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -import java.io.IOException; -import java.net.URLEncoder; -import java.util.LinkedHashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - - -/** - * This class is similar to MultiMapSolrParams except you can edit the - * parameters after it is initialized. It has helper functions to set/add - * integer and boolean param values. - * - * @since solr 1.3 - */ -public class ModifiableSolrParams extends SolrParams -{ - private Map<String,String[]> vals; - - public ModifiableSolrParams() - { - // LinkedHashMap so params show up in CGI in the same order as they are entered - vals = new LinkedHashMap<>(); - } - - /** Constructs a new ModifiableSolrParams directly using the provided Map<String,String[]> */ - public ModifiableSolrParams( Map<String,String[]> v ) - { - vals = v; - } - - /** Constructs a new ModifiableSolrParams, copying values from an existing SolrParams */ - public ModifiableSolrParams(SolrParams params) - { - vals = new LinkedHashMap<>(); - if( params != null ) { - this.add( params ); - } - } - - //---------------------------------------------------------------- - //---------------------------------------------------------------- - - /** - * Replace any existing parameter with the given name. if val==null remove key from params completely. - */ - public ModifiableSolrParams set( String name, String ... val ) { - if (val==null || (val.length==1 && val[0]==null)) { - vals.remove(name); - } else { - vals.put( name, val ); - } - return this; - } - - public ModifiableSolrParams set( String name, int val ) { - set( name, String.valueOf(val) ); - return this; - } - - public ModifiableSolrParams set( String name, boolean val ) { - set( name, String.valueOf(val) ); - return this; - } - - /** - * Add the given values to any existing name - * @param name Key - * @param val Array of value(s) added to the name. NOTE: If val is null - * or a member of val is null, then a corresponding null reference - * will be included when a get method is called on the key later. - * @return this - */ - public ModifiableSolrParams add( String name, String ... val ) { - String[] old = vals.put(name, val); - if( old != null ) { - if( val == null || val.length < 1 ) { - String[] both = new String[old.length+1]; - System.arraycopy(old, 0, both, 0, old.length); - both[old.length] = null; - vals.put( name, both ); - } - else { - String[] both = new String[old.length+val.length]; - System.arraycopy(old, 0, both, 0, old.length); - System.arraycopy(val, 0, both, old.length, val.length); - vals.put( name, both ); - } - } - return this; - } - - public void add(SolrParams params) - { - Iterator<String> names = params.getParameterNamesIterator(); - while (names.hasNext()) { - String name = names.next(); - set(name, params.getParams(name)); - } - } - - /** - * remove a field at the given name - */ - public String[] remove( String name ) - { - return vals.remove( name ); - } - - /** clear all parameters */ - public void clear() - { - vals.clear(); - } - - /** - * remove the given value for the given name - * - * @return true if the item was removed, false if null or not present - */ - public boolean remove(String name, String value) { - String[] tmp = vals.get(name); - if (tmp==null) return false; - for (int i=0; i<tmp.length; i++) { - if (tmp[i].equals(value)) { - String[] tmp2 = new String[tmp.length-1]; - if (tmp2.length==0) { - tmp2 = null; - remove(name); - } else { - System.arraycopy(tmp, 0, tmp2, 0, i); - System.arraycopy(tmp, i+1, tmp2, i, tmp.length-i-1); - set(name, tmp2); - } - return true; - } - } - return false; - } - - //---------------------------------------------------------------- - //---------------------------------------------------------------- - - @Override - public String get(String param) { - String[] v = vals.get( param ); - if( v!= null && v.length > 0 ) { - return v[0]; - } - return null; - } - - @Override - public Iterator<String> getParameterNamesIterator() { - return vals.keySet().iterator(); - } - - public Set<String> getParameterNames() { - return vals.keySet(); - } - - @Override - public String[] getParams(String param) { - return vals.get( param ); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(128); - try { - boolean first=true; - - for (Map.Entry<String,String[]> entry : vals.entrySet()) { - String key = entry.getKey(); - String[] valarr = entry.getValue(); - for (String val : valarr) { - if (!first) sb.append('&'); - first=false; - sb.append(key); - sb.append('='); - if( val != null ) { - sb.append( URLEncoder.encode( val, "UTF-8" ) ); - } - } - } - } - catch (IOException e) {throw new RuntimeException(e);} // can't happen - - return sb.toString(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/MoreLikeThisParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/MoreLikeThisParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/MoreLikeThisParams.java deleted file mode 100644 index 44a950f..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/MoreLikeThisParams.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -import java.util.Locale; - -/** - * @since solr 1.3 - */ -public interface MoreLikeThisParams -{ - // enable more like this -- this only applies to 'StandardRequestHandler' maybe DismaxRequestHandler - String MLT = "mlt"; - - String PREFIX = "mlt."; - - String SIMILARITY_FIELDS = PREFIX + "fl"; - String MIN_TERM_FREQ = PREFIX + "mintf"; - String MAX_DOC_FREQ = PREFIX + "maxdf"; - String MIN_DOC_FREQ = PREFIX + "mindf"; - String MIN_WORD_LEN = PREFIX + "minwl"; - String MAX_WORD_LEN = PREFIX + "maxwl"; - String MAX_QUERY_TERMS = PREFIX + "maxqt"; - String MAX_NUM_TOKENS_PARSED = PREFIX + "maxntp"; - String BOOST = PREFIX + "boost"; // boost or not? - String QF = PREFIX + "qf"; //boosting applied to mlt fields - - // the /mlt request handler uses 'rows' - String DOC_COUNT = PREFIX + "count"; - - // Do you want to include the original document in the results or not - String MATCH_INCLUDE = PREFIX + "match.include"; - - // If multiple docs are matched in the query, what offset do you want? - String MATCH_OFFSET = PREFIX + "match.offset"; - - // Do you want to include the original document in the results or not - String INTERESTING_TERMS = PREFIX + "interestingTerms"; // false,details,(list or true) - - public enum TermStyle { - NONE, - LIST, - DETAILS; - - public static TermStyle get( String p ) - { - if( p != null ) { - p = p.toUpperCase(Locale.ROOT); - if( p.equals( "DETAILS" ) ) { - return DETAILS; - } - else if( p.equals( "LIST" ) ) { - return LIST; - } - } - return NONE; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/MultiMapSolrParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/MultiMapSolrParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/MultiMapSolrParams.java deleted file mode 100644 index 684396b..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/MultiMapSolrParams.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -import org.apache.solr.common.util.StrUtils; - -import java.util.Iterator; -import java.util.Map; -import java.io.IOException; - -/** - * - */ -public class MultiMapSolrParams extends SolrParams { - protected final Map<String,String[]> map; - - public static void addParam(String name, String val, Map<String,String[]> map) { - String[] arr = map.get(name); - if (arr ==null) { - arr =new String[]{val}; - } else { - String[] newarr = new String[arr.length+1]; - System.arraycopy(arr,0,newarr,0,arr.length); - newarr[arr.length]=val; - arr =newarr; - } - map.put(name, arr); - } - - public MultiMapSolrParams(Map<String,String[]> map) { - this.map = map; - } - - @Override - public String get(String name) { - String[] arr = map.get(name); - return arr==null ? null : arr[0]; - } - - @Override - public String[] getParams(String name) { - return map.get(name); - } - - @Override - public Iterator<String> getParameterNamesIterator() { - return map.keySet().iterator(); - } - - public Map<String,String[]> getMap() { return map; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(128); - try { - boolean first=true; - - for (Map.Entry<String,String[]> entry : map.entrySet()) { - String key = entry.getKey(); - String[] valarr = entry.getValue(); - - for (String val : valarr) { - if (!first) sb.append('&'); - first=false; - sb.append(key); - sb.append('='); - StrUtils.partialURLEncodeVal(sb, val==null ? "" : val); - } - } - } - catch (IOException e) {throw new RuntimeException(e);} // can't happen - - return sb.toString(); - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/QueryElevationParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/QueryElevationParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/QueryElevationParams.java deleted file mode 100644 index 3271c38..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/QueryElevationParams.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -/** - * Parameters used with the QueryElevationComponent - * - **/ -public interface QueryElevationParams { - - String ENABLE = "enableElevation"; - String EXCLUSIVE = "exclusive"; - String FORCE_ELEVATION = "forceElevation"; - String IDS = "elevateIds"; - String EXCLUDE = "excludeIds"; - /** - * The name of the field that editorial results will be written out as when using the QueryElevationComponent, which - * automatically configures the EditorialMarkerFactory. The default name is "elevated" - * <br> - * See http://wiki.apache.org/solr/DocTransformers - */ - String EDITORIAL_MARKER_FIELD_NAME = "editorialMarkerFieldName"; - /** - * The name of the field that excluded editorial results will be written out as when using the QueryElevationComponent, which - * automatically configures the EditorialMarkerFactory. The default name is "excluded". This is only used - * when {@link #MARK_EXCLUDES} is set to true at query time. - * <br> - * See http://wiki.apache.org/solr/DocTransformers - */ - String EXCLUDE_MARKER_FIELD_NAME = "excludeMarkerFieldName"; - - /** - * Instead of removing excluded items from the results, passing in this parameter allows you to get back the excluded items, but to mark them - * as excluded. - */ - String MARK_EXCLUDES = "markExcludes"; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/RequiredSolrParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/RequiredSolrParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/RequiredSolrParams.java deleted file mode 100644 index 0b78d41..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/RequiredSolrParams.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -import org.apache.solr.common.SolrException; - -import java.util.Iterator; - -/** - * This is a simple wrapper to SolrParams that will throw a 400 - * exception if you ask for a parameter that does not exist. Fields - * specified with - * - * In short, any value you for from a <code>RequiredSolrParams</code> - * will return a valid non-null value or throw a 400 exception. - * (If you pass in <code>null</code> as the default value, you can - * get a null return value) - * - * - * @since solr 1.2 - */ -public class RequiredSolrParams extends SolrParams { - protected final SolrParams params; - - public RequiredSolrParams(SolrParams params) { - this.params = params; - } - - /** get the param from params, fail if not found **/ - @Override - public String get(String param) { - String val = params.get(param); - if( val == null ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Missing required parameter: "+param ); - } - return val; - } - - @Override - public String getFieldParam(final String field, final String param) { - final String fpname = fpname(field,param); - String val = params.get(fpname); - if (null == val) { - // don't call this.get, we want a specified exception message - val = params.get(param); - if (null == val) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, - "Missing required parameter: "+fpname+ - " (or default: "+param+")" ); - } - } - return val; - } - - @Override - public String[] getFieldParams(final String field, final String param) { - final String fpname = fpname(field,param); - String[] val = params.getParams(fpname); - if (null == val) { - // don't call this.getParams, we want a specified exception message - val = params.getParams(param); - if (null == val) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, - "Missing required parameter: "+fpname+ - " (or default: "+param+")" ); - } - } - return val; - } - - - @Override - public String[] getParams(String param) { - String[] vals = params.getParams(param); - if( vals == null || vals.length == 0 ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Missing required parameter: "+param ); - } - return vals; - } - - /** returns an Iterator over the parameter names */ - @Override - public Iterator<String> getParameterNamesIterator() { - return params.getParameterNamesIterator(); - } - - @Override - public String toString() { - return "{required("+params+")}"; - } - - //---------------------------------------------------------- - // Functions with a default value - pass directly to the - // wrapped SolrParams (they won't return null - unless it's the default) - //---------------------------------------------------------- - - @Override - public String get(String param, String def) { - return params.get(param, def); - } - - @Override - public int getInt(String param, int def) { - return params.getInt(param, def); - } - - @Override - public float getFloat(String param, float def) { - return params.getFloat(param, def); - } - - @Override - public boolean getBool(String param, boolean def) { - return params.getBool(param, def); - } - - @Override - public int getFieldInt(String field, String param, int def) { - return params.getFieldInt(field, param, def); - } - - @Override - public boolean getFieldBool(String field, String param, boolean def) { - return params.getFieldBool(field, param, def); - } - - @Override - public float getFieldFloat(String field, String param, float def) { - return params.getFieldFloat(field, param, def); - } - - @Override - public String getFieldParam(String field, String param, String def) { - return params.getFieldParam(field, param, def); - } - - public void check(String... params){ - for (String param : params) get(param); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/ShardParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/ShardParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/ShardParams.java deleted file mode 100644 index 70a39fd..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/ShardParams.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -/** - * Parameters used for distributed search. - */ -public interface ShardParams { - /** the shards to use (distributed configuration) */ - String SHARDS = "shards"; - - /** per-shard start and rows */ - String SHARDS_ROWS = "shards.rows"; - String SHARDS_START = "shards.start"; - - /** IDs of the shard documents */ - String IDS = "ids"; - - /** whether the request goes to a shard */ - String IS_SHARD = "isShard"; - - /** The requested URL for this shard */ - String SHARD_URL = "shard.url"; - - /** The Request Handler for shard requests */ - String SHARDS_QT = "shards.qt"; - - /** Request detailed match info for each shard (true/false) */ - String SHARDS_INFO = "shards.info"; - - /** Should things fail if there is an error? (true/false) */ - String SHARDS_TOLERANT = "shards.tolerant"; - - /** query purpose for shard requests */ - String SHARDS_PURPOSE = "shards.purpose"; - - String _ROUTE_ = "_route_"; - - /** Force a single-pass distributed query? (true/false) */ - String DISTRIB_SINGLE_PASS = "distrib.singlePass"; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/SimpleParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/SimpleParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/SimpleParams.java deleted file mode 100644 index 6788546..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/SimpleParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -/** - * Parameters used by the SimpleQParser. - */ -public interface SimpleParams { - /** Query fields and boosts. */ - String QF = "qf"; - - /** Override the currently enabled/disabled query operators. */ - String QO = "q.operators"; - - /** Enables {@code AND} operator (+) */ - String AND_OPERATOR = "AND"; - /** Enables {@code NOT} operator (-) */ - String NOT_OPERATOR = "NOT"; - /** Enables {@code OR} operator (|) */ - String OR_OPERATOR = "OR"; - /** Enables {@code PREFIX} operator (*) */ - String PREFIX_OPERATOR = "PREFIX"; - /** Enables {@code PHRASE} operator (") */ - String PHRASE_OPERATOR = "PHRASE"; - /** Enables {@code PRECEDENCE} operators: {@code (} and {@code )} */ - String PRECEDENCE_OPERATORS = "PRECEDENCE"; - /** Enables {@code ESCAPE} operator (\) */ - String ESCAPE_OPERATOR = "ESCAPE"; - /** Enables {@code WHITESPACE} operators: ' ' '\n' '\r' '\t' */ - String WHITESPACE_OPERATOR = "WHITESPACE"; - /** Enables {@code FUZZY} operator (~) */ - String FUZZY_OPERATOR = "FUZZY"; - /** Enables {@code NEAR} operator (~) */ - String NEAR_OPERATOR = "NEAR"; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/SolrParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/SolrParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/SolrParams.java deleted file mode 100644 index 36d0df1..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/SolrParams.java +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -import org.apache.solr.common.SolrException; -import org.apache.solr.common.util.NamedList; -import org.apache.solr.common.util.SimpleOrderedMap; -import org.apache.solr.common.util.StrUtils; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** SolrParams hold request parameters. - * - * - */ -public abstract class SolrParams implements Serializable { - - /** returns the String value of a param, or null if not set */ - public abstract String get(String param); - - /** returns an array of the String values of a param, or null if none */ - public abstract String[] getParams(String param); - - /** returns an Iterator over the parameter names */ - public abstract Iterator<String> getParameterNamesIterator(); - - /** returns the value of the param, or def if not set */ - public String get(String param, String def) { - String val = get(param); - return val==null ? def : val; - } - - /** returns a RequiredSolrParams wrapping this */ - public RequiredSolrParams required() - { - // TODO? should we want to stash a reference? - return new RequiredSolrParams(this); - } - - protected String fpname(String field, String param) { - return "f."+field+'.'+param; - } - - /** returns the String value of the field parameter, "f.field.param", or - * the value for "param" if that is not set. - */ - public String getFieldParam(String field, String param) { - String val = get(fpname(field,param)); - return val!=null ? val : get(param); - } - - /** returns the String value of the field parameter, "f.field.param", or - * the value for "param" if that is not set. If that is not set, def - */ - public String getFieldParam(String field, String param, String def) { - String val = get(fpname(field,param)); - return val!=null ? val : get(param, def); - } - - /** returns the String values of the field parameter, "f.field.param", or - * the values for "param" if that is not set. - */ - public String[] getFieldParams(String field, String param) { - String[] val = getParams(fpname(field,param)); - return val!=null ? val : getParams(param); - } - - /** Returns the Boolean value of the param, or null if not set */ - public Boolean getBool(String param) { - String val = get(param); - return val==null ? null : StrUtils.parseBool(val); - } - - /** Returns the boolean value of the param, or def if not set */ - public boolean getBool(String param, boolean def) { - String val = get(param); - return val==null ? def : StrUtils.parseBool(val); - } - - /** Returns the Boolean value of the field param, - or the value for param, or null if neither is set. */ - public Boolean getFieldBool(String field, String param) { - String val = getFieldParam(field, param); - return val==null ? null : StrUtils.parseBool(val); - } - - /** Returns the boolean value of the field param, - or the value for param, or def if neither is set. */ - public boolean getFieldBool(String field, String param, boolean def) { - String val = getFieldParam(field, param); - return val==null ? def : StrUtils.parseBool(val); - } - - /** Returns the Integer value of the param, or null if not set */ - public Integer getInt(String param) { - String val = get(param); - try { - return val==null ? null : Integer.valueOf(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - /** Returns the Long value of the param, or null if not set */ - public Long getLong(String param, Long def) { - String val = get(param); - try { - return val== null ? def : Long.parseLong(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - /** Returns the int value of the param, or def if not set */ - public int getInt(String param, int def) { - String val = get(param); - try { - return val==null ? def : Integer.parseInt(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - /** Returns the Long value of the param, or null if not set */ - public Long getLong(String param) { - String val = get(param); - try { - return val == null ? null : Long.valueOf(val); - } catch (Exception ex) { - throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex); - } - } - - /** Returns the long value of the param, or def if not set */ - public long getLong(String param, long def) { - String val = get(param); - try { - return val == null ? def : Long.parseLong(val); - } catch (Exception ex) { - throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex); - } - } - - - /** - * @return The int value of the field param, or the value for param - * or <code>null</code> if neither is set. - **/ - public Integer getFieldInt(String field, String param) { - String val = getFieldParam(field, param); - try { - return val==null ? null : Integer.valueOf(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - /** Returns the int value of the field param, - or the value for param, or def if neither is set. */ - public int getFieldInt(String field, String param, int def) { - String val = getFieldParam(field, param); - try { - return val==null ? def : Integer.parseInt(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - - /** Returns the Float value of the param, or null if not set */ - public Float getFloat(String param) { - String val = get(param); - try { - return val==null ? null : Float.valueOf(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - /** Returns the float value of the param, or def if not set */ - public float getFloat(String param, float def) { - String val = get(param); - try { - return val==null ? def : Float.parseFloat(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - /** Returns the Float value of the param, or null if not set */ - public Double getDouble(String param) { - String val = get(param); - try { - return val==null ? null : Double.valueOf(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - /** Returns the float value of the param, or def if not set */ - public double getDouble(String param, double def) { - String val = get(param); - try { - return val==null ? def : Double.parseDouble(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - - /** Returns the float value of the field param. */ - public Float getFieldFloat(String field, String param) { - String val = getFieldParam(field, param); - try { - return val==null ? null : Float.valueOf(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - /** Returns the float value of the field param, - or the value for param, or def if neither is set. */ - public float getFieldFloat(String field, String param, float def) { - String val = getFieldParam(field, param); - try { - return val==null ? def : Float.parseFloat(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - /** Returns the float value of the field param. */ - public Double getFieldDouble(String field, String param) { - String val = getFieldParam(field, param); - try { - return val==null ? null : Double.valueOf(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - /** Returns the float value of the field param, - or the value for param, or def if neither is set. */ - public double getFieldDouble(String field, String param, double def) { - String val = getFieldParam(field, param); - try { - return val==null ? def : Double.parseDouble(val); - } - catch( Exception ex ) { - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); - } - } - - public static SolrParams wrapDefaults(SolrParams params, SolrParams defaults) { - if (params == null) - return defaults; - if (defaults == null) - return params; - return new DefaultSolrParams(params,defaults); - } - - public static SolrParams wrapAppended(SolrParams params, SolrParams defaults) { - if (params == null) - return defaults; - if (defaults == null) - return params; - return AppendedSolrParams.wrapAppended(params,defaults); - } - - /** Create a Map<String,String> from a NamedList given no keys are repeated */ - public static Map<String,String> toMap(NamedList params) { - HashMap<String,String> map = new HashMap<>(); - for (int i=0; i<params.size(); i++) { - map.put(params.getName(i), params.getVal(i).toString()); - } - return map; - } - - /** Create a Map<String,String[]> from a NamedList */ - public static Map<String,String[]> toMultiMap(NamedList params) { - HashMap<String,String[]> map = new HashMap<>(); - for (int i=0; i<params.size(); i++) { - String name = params.getName(i); - String val = params.getVal(i).toString(); - MultiMapSolrParams.addParam(name,val,map); - } - return map; - } - - /** Create SolrParams from NamedList. */ - public static SolrParams toSolrParams(NamedList params) { - // if no keys are repeated use the faster MapSolrParams - HashMap<String,String> map = new HashMap<>(); - for (int i=0; i<params.size(); i++) { - String prev = map.put(params.getName(i), params.getVal(i).toString()); - if (prev!=null) return new MultiMapSolrParams(toMultiMap(params)); - } - return new MapSolrParams(map); - } - - /** Create filtered SolrParams. */ - public SolrParams toFilteredSolrParams(List<String> names) { - NamedList<String> nl = new NamedList<>(); - for (Iterator<String> it = getParameterNamesIterator(); it.hasNext();) { - final String name = it.next(); - if (names.contains(name)) { - final String[] values = getParams(name); - for (String value : values) { - nl.add(name, value); - } - } - } - return toSolrParams(nl); - } - - /** Convert this to a NamedList */ - public NamedList<Object> toNamedList() { - final SimpleOrderedMap<Object> result = new SimpleOrderedMap<>(); - - for(Iterator<String> it=getParameterNamesIterator(); it.hasNext(); ) { - final String name = it.next(); - final String [] values = getParams(name); - if(values.length==1) { - result.add(name,values[0]); - } else { - // currently no reason not to use the same array - result.add(name,values); - } - } - return result; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/SpatialParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/SpatialParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/SpatialParams.java deleted file mode 100644 index 39f3dbe..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/SpatialParams.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - - -/** - * - * - **/ -public interface SpatialParams { - String POINT = "pt"; - String DISTANCE = "d"; - String FIELD = "sfield"; // the field that contains the points we are measuring from "pt" - /** - * km - kilometers - * mi - miles - */ - String UNITS = "units"; - /** - * The distance measure to use. - */ - String MEASURE = "meas"; - /** - * The radius of the sphere to use to in calculating spherical distances like Haversine - */ - String SPHERE_RADIUS = "sphere_radius"; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/SpellingParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/SpellingParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/SpellingParams.java deleted file mode 100644 index 0a54606..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/SpellingParams.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -/** - * Parameters used for spellchecking - * - * @since solr 1.3 - */ -public interface SpellingParams { - - String SPELLCHECK_PREFIX = "spellcheck."; - - /** - * The name of the dictionary to be used for giving the suggestion for a - * request. The value for this parameter is configured in solrconfig.xml - */ - String SPELLCHECK_DICT = SPELLCHECK_PREFIX + "dictionary"; - - /** - * The count of suggestions to return for each query term not in the index and/or dictionary. - * <p> - * If this parameter is absent in the request then only one suggestion is - * returned. If it is more than one then a maximum of given suggestions are - * returned for each token in the query. - */ - String SPELLCHECK_COUNT = SPELLCHECK_PREFIX + "count"; - - /** - * The count of suggestions to return for each query term existing in the index and/or dictionary. - * <p> - * If this parameter is absent in the request then no suggestions are generated. This parameter allows - * for receiving alternative terms to use in context-sensitive spelling corrections. - */ - String SPELLCHECK_ALTERNATIVE_TERM_COUNT = SPELLCHECK_PREFIX + "alternativeTermCount"; - - /** - * <p> - * The maximum number of hits the request can return in order to both - * generate spelling suggestions and set the "correctlySpelled" element to "false". - * Note that this parameter is typically of use only in conjunction with "spellcheck.alternativeTermCount". - * </p> - * <p> - * If left unspecified, the default behavior will prevail. That is, "correctlySpelled" will be false and suggestions - * will be returned only if one or more of the query terms are absent from the dictionary and/or index. If set to zero, - * the "correctlySpelled" flag will be false only if the response returns zero hits. If set to a value greater than zero, - * suggestions will be returned even if hits are returned (up to the specified number). This number also will serve as - * the threshold in determining the value of "correctlySpelled". Specifying a value greater than zero is useful - * for creating "did-you-mean" suggestions for queries that return a low number of hits. - * </p> - */ - String SPELLCHECK_MAX_RESULTS_FOR_SUGGEST = SPELLCHECK_PREFIX + "maxResultsForSuggest"; - - /** - * When this parameter is set to true and the misspelled word exists in the - * user field, only words that occur more frequently in the Solr field than - * the one given will be returned. The default value is false. - * <p> - * <b>This is applicable only for dictionaries built from Solr fields.</b> - */ - String SPELLCHECK_ONLY_MORE_POPULAR = SPELLCHECK_PREFIX + "onlyMorePopular"; - - /** - * Whether to use the extended response format, which is more complicated but - * richer. Returns the document frequency for each suggestion and returns one - * suggestion block for each term in the query string. Default is false. - * <p> - * <b>This is applicable only for dictionaries built from Solr fields.</b> - */ - String SPELLCHECK_EXTENDED_RESULTS = SPELLCHECK_PREFIX + "extendedResults"; - - /** - * Use the value for this parameter as the query to spell check. - * <p> - * This parameter is <b>optional</b>. If absent, then the q parameter is - * used. - */ - String SPELLCHECK_Q = SPELLCHECK_PREFIX + "q"; - - /** - * Whether to build the index or not. Optional and false by default. - */ - String SPELLCHECK_BUILD = SPELLCHECK_PREFIX + "build"; - - /** - * Whether to reload the index. Optional and false by default. - */ - String SPELLCHECK_RELOAD = SPELLCHECK_PREFIX + "reload"; - - /** - * Take the top suggestion for each token and create a new query from it - */ - String SPELLCHECK_COLLATE = SPELLCHECK_PREFIX + "collate"; - /** - * <p> - * The maximum number of collations to return. Default=1. Ignored if "spellcheck.collate" is false. - * </p> - */ - String SPELLCHECK_MAX_COLLATIONS = SPELLCHECK_PREFIX + "maxCollations"; - /** - * <p> - * The maximum number of collations to test by querying against the index. - * When testing, the collation is substituted for the original query's "q" param. Any "qf"s are retained. - * If this is set to zero, does not test for hits before returning collations (returned collations may result in zero hits). - * Default=0. Ignored of "spellcheck.collate" is false. - * </p> - */ - String SPELLCHECK_MAX_COLLATION_TRIES = SPELLCHECK_PREFIX + "maxCollationTries"; - /** - * <p> - * The maximum number of word correction combinations to rank and evaluate prior to deciding which collation - * candidates to test against the index. This is a performance safety-net in cases a user enters a query with - * many misspelled words. The default is 10,000 combinations. - * </p> - */ - String SPELLCHECK_MAX_COLLATION_EVALUATIONS = SPELLCHECK_PREFIX + "maxCollationEvaluations"; - /** - * <p> - * For use with {@link SpellingParams#SPELLCHECK_MAX_COLLATION_TRIES} and - * {@link SpellingParams#SPELLCHECK_COLLATE_EXTENDED_RESULTS}. - * A performance optimization in cases where the exact number of hits a collation would return is not needed. - * Specify "0" to return the exact # of hits, otherwise give the maximum documents Lucene should collect - * with which to base an estimate. The higher the value the more likely the estimates will be accurate - * (at expense of performance). - * </p> - * - * <p> - * The default is 0 (report exact hit-counts) when {@link SpellingParams#SPELLCHECK_COLLATE_EXTENDED_RESULTS} is TRUE. - * When {@link SpellingParams#SPELLCHECK_COLLATE_EXTENDED_RESULTS} is FALSE, this optimization is always performed. - * </p> - */ - String SPELLCHECK_COLLATE_MAX_COLLECT_DOCS = SPELLCHECK_PREFIX + "collateMaxCollectDocs"; - /** - * <p> - * Whether to use the Extended Results Format for collations. - * Includes "before>after" pairs to easily allow clients to generate messages like "no results for PORK. did you mean POLK?" - * Also indicates the # of hits each collation will return on re-query. Default=false, which retains 1.4-compatible output. - * </p> - * <p> - * Note: that if {@link SpellingParams#SPELLCHECK_COLLATE_MAX_COLLECT_DOCS} is set to a value greater than 0, - * then the hit counts returned by this will be estimated. - * </p> - */ - String SPELLCHECK_COLLATE_EXTENDED_RESULTS = SPELLCHECK_PREFIX + "collateExtendedResults"; - - /** - * <p> - * For use with {@link SpellingParams#SPELLCHECK_MAX_COLLATION_TRIES}, use this to override any original query parameters - * when issuing test queries. For instance, if the original query has "mm=1" but it is preferred to test collations - * with "mm=100%", then use "spellcheck.collateParam.mm=100%". - * </p> - */ - String SPELLCHECK_COLLATE_PARAM_OVERRIDE = SPELLCHECK_PREFIX + "collateParam."; - /** - * Certain spelling implementations may allow for an accuracy setting. - */ - String SPELLCHECK_ACCURACY = SPELLCHECK_PREFIX + "accuracy"; - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/StatsParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/StatsParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/StatsParams.java deleted file mode 100644 index d287fa3..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/StatsParams.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -/** - * Stats Parameters - */ -public interface StatsParams { - String STATS = "stats"; - String STATS_FIELD = STATS + ".field"; - String STATS_FACET = STATS + ".facet"; - String STATS_CALC_DISTINCT = STATS + ".calcdistinct"; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/TermVectorParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/TermVectorParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/TermVectorParams.java deleted file mode 100644 index 438bf5e..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/TermVectorParams.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -/** - * - * - **/ -public interface TermVectorParams { - - String TV_PREFIX = "tv."; - - /** - * Return Term Frequency info - * */ - String TF = TV_PREFIX + "tf"; - /** - * Return Term Vector position information - * - * */ - String POSITIONS = TV_PREFIX + "positions"; - /** - * Return offset information, if available - * */ - String OFFSETS = TV_PREFIX + "offsets"; - /** - * Return IDF information. May be expensive - * */ - String DF = TV_PREFIX + "df"; - - /** - * Return TF-IDF calculation, i.e. (tf / idf). May be expensive. - */ - String TF_IDF = TV_PREFIX + "tf_idf"; - - - /** - * Return all the options: TF, positions, offsets, idf - */ - String ALL = TV_PREFIX + "all"; - - /** - * The fields to get term vectors for - */ - String FIELDS = TV_PREFIX + "fl"; - - /** - * The Doc Ids (Lucene internal ids) of the docs to get the term vectors for - */ - String DOC_IDS = TV_PREFIX + "docIds"; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/TermsParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/TermsParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/TermsParams.java deleted file mode 100644 index 63d1d28..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/TermsParams.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -import java.util.regex.Pattern; - -/** - * - * - **/ -public interface TermsParams { - /** - * The component name. Set to true to turn on the TermsComponent - */ - String TERMS = "terms"; - - /** - * Used for building up the other terms - */ - String TERMS_PREFIX = TERMS + "."; - - /** - * Required. Specify the field to look up terms in. - */ - String TERMS_FIELD = TERMS_PREFIX + "fl"; - - /** - * Optional. The lower bound term to start at. The TermEnum will start at the next term after this term in the dictionary. - * - * If not specified, the empty string is used - */ - String TERMS_LOWER = TERMS_PREFIX + "lower"; - - /** - * Optional. The term to stop at. - * - * @see #TERMS_UPPER_INCLUSIVE - */ - String TERMS_UPPER = TERMS_PREFIX + "upper"; - /** - * Optional. If true, include the upper bound term in the results. False by default. - */ - String TERMS_UPPER_INCLUSIVE = TERMS_PREFIX + "upper.incl"; - - /** - * Optional. If true, include the lower bound term in the results, otherwise skip to the next one. True by default. - */ - String TERMS_LOWER_INCLUSIVE = TERMS_PREFIX + "lower.incl"; - - /** - * Optional. The number of results to return. If not specified, looks for {@link org.apache.solr.common.params.CommonParams#ROWS}. If that's not specified, uses 10. - */ - String TERMS_LIMIT = TERMS_PREFIX + "limit"; - - String TERMS_PREFIX_STR = TERMS_PREFIX + "prefix"; - - String TERMS_REGEXP_STR = TERMS_PREFIX + "regex"; - - String TERMS_REGEXP_FLAG = TERMS_REGEXP_STR + ".flag"; - - static enum TermsRegexpFlag { - UNIX_LINES(Pattern.UNIX_LINES), - CASE_INSENSITIVE(Pattern.CASE_INSENSITIVE), - COMMENTS(Pattern.COMMENTS), - MULTILINE(Pattern.MULTILINE), - LITERAL(Pattern.LITERAL), - DOTALL(Pattern.DOTALL), - UNICODE_CASE(Pattern.UNICODE_CASE), - CANON_EQ(Pattern.CANON_EQ); - - int value; - - TermsRegexpFlag(int value) { - this.value = value; - } - - int getValue() { - return value; - } - } - - /** - * Optional. The minimum value of docFreq to be returned. 1 by default - */ - String TERMS_MINCOUNT = TERMS_PREFIX + "mincount"; - /** - * Optional. The maximum value of docFreq to be returned. -1 by default means no boundary - */ - String TERMS_MAXCOUNT = TERMS_PREFIX + "maxcount"; - - /** - * Optional. If true, return the raw characters of the indexed term, regardless of if it is readable. - * For instance, the index form of numeric numbers is not human readable. The default is false. - */ - String TERMS_RAW = TERMS_PREFIX + "raw"; - - /** - * Optional. If sorting by frequency is enabled. Defaults to sorting by count. - */ - String TERMS_SORT = TERMS_PREFIX + "sort"; - - String TERMS_SORT_COUNT = "count"; - String TERMS_SORT_INDEX = "index"; -} - http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/UpdateParams.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/UpdateParams.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/UpdateParams.java deleted file mode 100644 index 75f8857..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/UpdateParams.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.common.params; - -/** - * A collection of standard params used by Update handlers - * - * - * @since solr 1.2 - */ -public interface UpdateParams -{ - - /** Open up a new searcher as part of a commit */ - String OPEN_SEARCHER = "openSearcher"; - - /** wait for the searcher to be registered/visible */ - String WAIT_SEARCHER = "waitSearcher"; - - String SOFT_COMMIT = "softCommit"; - - /** overwrite indexing fields */ - String OVERWRITE = "overwrite"; - - /** Commit everything after the command completes */ - String COMMIT = "commit"; - - /** Commit within a certain time period (in ms) */ - String COMMIT_WITHIN = "commitWithin"; - - /** Optimize the index and commit everything after the command completes */ - String OPTIMIZE = "optimize"; - - /** expert: calls IndexWriter.prepareCommit */ - String PREPARE_COMMIT = "prepareCommit"; - - /** Rollback update commands */ - String ROLLBACK = "rollback"; - - String COLLECTION = "collection"; - - /** Select the update processor chain to use. A RequestHandler may or may not respect this parameter */ - String UPDATE_CHAIN = "update.chain"; - - /** Override the content type used for UpdateLoader **/ - String ASSUME_CONTENT_TYPE = "update.contentType"; - - /** - * If optimizing, set the maximum number of segments left in the index after optimization. 1 is the default (and is equivalent to calling IndexWriter.optimize() in Lucene). - */ - String MAX_OPTIMIZE_SEGMENTS = "maxSegments"; - - String EXPUNGE_DELETES = "expungeDeletes"; - - /** Return versions of updates? */ - String VERSIONS = "versions"; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d9a661cf/ranger_solrj/src/main/java/org/apache/solr/common/params/package-info.java ---------------------------------------------------------------------- diff --git a/ranger_solrj/src/main/java/org/apache/solr/common/params/package-info.java b/ranger_solrj/src/main/java/org/apache/solr/common/params/package-info.java deleted file mode 100644 index 94622cc..0000000 --- a/ranger_solrj/src/main/java/org/apache/solr/common/params/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Parameter constants and enumerations. - */ -package org.apache.solr.common.params; -
