Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions remove_precision_step.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash
# Script to remove precisionStep property from all XML files
# Usage: ./remove_precision_step.sh [--dry-run]

set -e

DRY_RUN=false
if [[ "$1" == "--dry-run" ]]; then
DRY_RUN=true
echo "=== DRY RUN MODE ==="
echo "No files will be modified."
echo ""
fi

# Get the script's directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Find all XML files
XML_FILES=$(find "$SCRIPT_DIR" -type f -name "*.xml")

if [[ -z "$XML_FILES" ]]; then
echo "No XML files found."
exit 0
fi

FILE_COUNT=$(echo "$XML_FILES" | wc -l | tr -d ' ')
echo "Found $FILE_COUNT XML files."
echo ""

MODIFIED_COUNT=0

while IFS= read -r file; do
# Check if file contains precisionStep
if grep -q 'precisionStep="' "$file"; then
if [[ "$DRY_RUN" == true ]]; then
echo "[DRY RUN] Would modify: $file"
# Show what would be removed
grep -o ' precisionStep="[^"]*"' "$file" | sort -u | sed 's/^/ Found: /'
else
# Use sed to remove precisionStep attribute
# Works on both macOS (BSD sed) and Linux (GNU sed)
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS requires empty string after -i
sed -i '' 's/ precisionStep="[^"]*"//g' "$file"
else
# Linux
sed -i 's/ precisionStep="[^"]*"//g' "$file"
fi
echo "Modified: $file"
fi
((MODIFIED_COUNT++))
fi
done <<< "$XML_FILES"

echo ""
if [[ "$DRY_RUN" == true ]]; then
echo "Would modify $MODIFIED_COUNT out of $FILE_COUNT files."
echo ""
echo "Run without --dry-run to actually modify files."
else
echo "Modified $MODIFIED_COUNT out of $FILE_COUNT files."
fi
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.apache.solr.schema.FieldType;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.SchemaField;
import org.apache.solr.schema.TrieField;
import org.apache.solr.search.DocSet;
import org.apache.solr.search.SyntaxError;

Expand Down Expand Up @@ -90,7 +89,7 @@ public void getFacetRangeCounts(RangeFacetRequest rangeFacetRequest, NamedList<O
final FieldType ft = sf.getType();

if (method.equals(FacetRangeMethod.DV)) {
assert ft instanceof TrieField || ft.isPointField();
assert ft.isPointField();
resOuter.add(key, getFacetRangeCountsDocValues(rangeFacetRequest));
} else {
resOuter.add(key, getFacetRangeCounts(rangeFacetRequest));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
import org.apache.solr.schema.FieldType;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.SchemaField;
import org.apache.solr.schema.TrieDateField;
import org.apache.solr.schema.TrieField;
import org.apache.solr.util.DateMathParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -156,29 +154,7 @@ private RangeEndpointCalculator<? extends Comparable<?>> createCalculator() {
RangeEndpointCalculator<?> calc;
FieldType ft = schemaField.getType();

if (ft instanceof TrieField) {
switch (ft.getNumberType()) {
case FLOAT:
calc = new FloatRangeEndpointCalculator(this);
break;
case DOUBLE:
calc = new DoubleRangeEndpointCalculator(this);
break;
case INTEGER:
calc = new IntegerRangeEndpointCalculator(this);
break;
case LONG:
calc = new LongRangeEndpointCalculator(this);
break;
case DATE:
calc = new DateRangeEndpointCalculator(this, null);
break;
default:
throw new SolrException(
SolrException.ErrorCode.BAD_REQUEST,
"Unable to range facet on Trie field of unexpected type:" + this.facetOn);
}
} else if (ft instanceof DateRangeField) {
if (ft instanceof DateRangeField) {
calc = new DateRangeEndpointCalculator(this, null);
} else if (ft.isPointField()) {
switch (ft.getNumberType()) {
Expand Down Expand Up @@ -766,8 +742,7 @@ private static class DateRangeEndpointCalculator extends RangeEndpointCalculator
public DateRangeEndpointCalculator(final RangeFacetRequest rangeFacetRequest, final Date now) {
super(rangeFacetRequest);
this.now = now;
if (!(field.getType() instanceof TrieDateField)
&& !(field.getType() instanceof DateRangeField)
if (!(field.getType() instanceof DateRangeField)
&& !(field.getType() instanceof DatePointField)) {
throw new IllegalArgumentException(TYPE_ERR_MSG);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
import org.apache.solr.schema.PointField;
import org.apache.solr.schema.SchemaField;
import org.apache.solr.schema.StrField;
import org.apache.solr.schema.TrieDateField;
import org.apache.solr.schema.TrieField;
import org.apache.solr.util.hll.HLL;
import org.apache.solr.util.hll.HLLType;

Expand All @@ -70,13 +68,13 @@ public static StatsValues createStatsValues(StatsField statsField) {

final FieldType fieldType = sf.getType(); // TODO: allow FieldType to provide impl.

if (TrieDateField.class.isInstance(fieldType) || DatePointField.class.isInstance(fieldType)) {
if (DatePointField.class.isInstance(fieldType)) {
DateStatsValues statsValues = new DateStatsValues(statsField);
if (sf.multiValued()) {
return new SortedDateStatsValues(statsValues, statsField);
}
return statsValues;
} else if (TrieField.class.isInstance(fieldType) || PointField.class.isInstance(fieldType)) {
} else if (PointField.class.isInstance(fieldType)) {

NumericStatsValues statsValue = new NumericStatsValues(statsField);
if (sf.multiValued()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,6 @@ protected Object doHighlightingOfField(
Object fieldHighlights;
if (schemaField == null) {
fieldHighlights = null;
} else if (schemaField.getType() instanceof org.apache.solr.schema.TrieField) {
// TODO: highlighting numeric fields is broken (Lucene) - so we disable them until fixed (see
// LUCENE-3080)!
fieldHighlights = null;
} else if (useFastVectorHighlighter(params, schemaField)) {
if (fvhContainer.fieldQuery == null) {
FastVectorHighlighter fvh =
Expand Down
Loading
Loading