Skip to content
Open
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
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ c99af207c761ec34812ef1cc3054eb2804b7448b

# Gradle reformat PR #4037
92792f735615c1f628da6cf7fa408f29ca1f7485

# SOLR-18296 [google java formatter applied]
71bb2cd3f8404460d09d2de449fdff2cc24266c1
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ private void check(Element element) {
case PACKAGE:
checkComment(element);
break;
// class-like elements, check them, then recursively check their children (fields and
// methods)
// class-like elements, check them, then recursively check their children (fields and
// methods)
case CLASS:
case INTERFACE:
case ENUM:
Expand All @@ -251,7 +251,7 @@ private void check(Element element) {
}
}
break;
// method-like elements, check them if we are configured to do so
// method-like elements, check them if we are configured to do so
case METHOD:
case CONSTRUCTOR:
case FIELD:
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/gjf-SOLR-18296.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: Upgrade google-java-format to 1.35.0 (fixes JDK 24/25 build break)
type: dependency_update
authors:
- name: Serhiy Bzhezytskyy
links:
- name: SOLR-18296
url: https://issues.apache.org/jira/browse/SOLR-18296
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ google-guava = "33.6.0-jre"
# @keep for version alignment
google-j2objc = "3.1"
# @keep This is GJF version for spotless/ tidy.
google-javaformat = "1.18.1"
google-javaformat = "1.35.0"
# @keep for version alignment
google-protobuf = "4.35.1"
# @keep Gradle version to run the build
Expand Down
20 changes: 10 additions & 10 deletions solr/core/src/java/org/apache/solr/blockcache/BlockDirectory.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,21 +323,21 @@ boolean useReadCache(String name, IOContext context) {
return false;
}
switch (context.context()) {
// depending on params, we don't cache on merges or when only reading once
// depending on params, we don't cache on merges or when only reading once
case MERGE:
{
return cacheMerges;
}
/* TODO
case READ:
{
if (context.readOnce) {
return cacheReadOnce;
} else {
return true;
}
/* TODO
case READ:
{
if (context.readOnce) {
return cacheReadOnce;
} else {
return true;
}
*/
}
*/
default:
{
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ SolrInputDocument readDocument(XMLStreamReader reader, IndexSchema schema)
while (true) {
int event = reader.next();
switch (event) {
// Add everything to the text
// Add everything to the text
case XMLStreamConstants.SPACE:
case XMLStreamConstants.CDATA:
case XMLStreamConstants.CHARACTERS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,9 @@ private BackupStats incrementalCopy(Collection<String> indexFiles, Directory dir
case Error err -> throw err;
case IOException ioe -> throw ioe;
case RuntimeException re -> throw re;
default -> throw new SolrException(
SolrException.ErrorCode.UNKNOWN, "Error during parallel backup upload", cause);
default ->
throw new SolrException(
SolrException.ErrorCode.UNKNOWN, "Error during parallel backup upload", cause);
}
} catch (InterruptedException e) {
uploadFutures.forEach(f -> f.cancel(true));
Expand Down
5 changes: 3 additions & 2 deletions solr/core/src/java/org/apache/solr/handler/RestoreCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@ public boolean doRestore() throws Exception {
case Error err -> throw err;
case IOException ioe -> throw ioe;
case RuntimeException re -> throw re;
default -> throw new SolrException(
SolrException.ErrorCode.UNKNOWN, "Error during parallel restore download", cause);
default ->
throw new SolrException(
SolrException.ErrorCode.UNKNOWN, "Error during parallel restore download", cause);
}
} catch (InterruptedException e) {
downloadFutures.forEach(f -> f.cancel(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,10 @@ private FilterType extractFilterType(SolrParams params) {
case "none" -> FilterType.none;
case "name" -> FilterType.name;
case "status" -> FilterType.status;
default -> throw new SolrException(
ErrorCode.BAD_REQUEST,
"Invalid filterType '" + filterType + "'. Allowed values are: none, name, status");
default ->
throw new SolrException(
ErrorCode.BAD_REQUEST,
"Invalid filterType '" + filterType + "'. Allowed values are: none, name, status");
};
}
return FilterType.none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ public static PivotFacetValue createFromNamedList(
case STATS -> statsValues = (NamedList<NamedList<NamedList<?>>>) value;
case QUERIES -> queryCounts = (NamedList<Number>) value;
case RANGES -> ranges = (SimpleOrderedMap<SimpleOrderedMap<Object>>) value;
default -> throw new RuntimeException(
"PivotListEntry contains unaccounted for item: " + pivotEntry);
default ->
throw new RuntimeException(
"PivotListEntry contains unaccounted for item: " + pivotEntry);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ protected String stageToString(int stage) {
return "EXECUTE_QUERY";
case STAGE_GET_FIELDS:
return "GET_FIELDS";
// nobody wants to think it was DONE and canceled after it completed...
// nobody wants to think it was DONE and canceled after it completed...
case STAGE_DONE:
return "FINISHING";
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void processUpdate(Reader reader) throws IOException {
}
break;
}
// fall through
// fall through

case JSONParser.LONG:
case JSONParser.NUMBER:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void processDelete(SolrQueryRequest req, UpdateRequestProcessor processor, XMLSt
deleteCmd.clear();
break;

// Add everything to the text
// Add everything to the text
case XMLStreamConstants.SPACE:
case XMLStreamConstants.CDATA:
case XMLStreamConstants.CHARACTERS:
Expand Down Expand Up @@ -356,7 +356,7 @@ protected SolrInputDocument readDoc(XMLStreamReader parser, boolean forgiveNameA
while (!complete) {
int event = parser.next();
switch (event) {
// Add everything to the text
// Add everything to the text
case XMLStreamConstants.SPACE:
case XMLStreamConstants.CDATA:
case XMLStreamConstants.CHARACTERS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private boolean seekPrefix() throws IOException {
if (termsEnum.next() == null) { // case END
return false;
}
// fall through to NOT_FOUND
// fall through to NOT_FOUND

case NOT_FOUND:
// termsEnum must start with prefixBuf to continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void printlnComment(String comment) throws IOException {
if (i + 1 < comment.length() && comment.charAt(i + 1) == '\n') {
i++;
}
// break intentionally excluded.
// break intentionally excluded.
case '\n':
println();
out.write(this.strategy.getCommentStart());
Expand Down
24 changes: 12 additions & 12 deletions solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@ private void writeFieldTypes(List<SimpleOrderedMap<Object>> fieldTypePropertiesL
Object fieldTypePropValue = fieldTypeProperty.getValue();

switch (fieldTypePropName) {
case FieldType.ANALYZER -> analyzerProperties =
(SimpleOrderedMap<Object>) fieldTypePropValue;
case FieldType.INDEX_ANALYZER -> indexAnalyzerProperties =
(SimpleOrderedMap<Object>) fieldTypePropValue;
case FieldType.QUERY_ANALYZER -> queryAnalyzerProperties =
(SimpleOrderedMap<Object>) fieldTypePropValue;
case FieldType.MULTI_TERM_ANALYZER -> multiTermAnalyzerProperties =
(SimpleOrderedMap<Object>) fieldTypePropValue;
case FieldType.SIMILARITY -> perFieldSimilarityProperties =
(SimpleOrderedMap<Object>) fieldTypePropValue;
case FieldType.ANALYZER ->
analyzerProperties = (SimpleOrderedMap<Object>) fieldTypePropValue;
case FieldType.INDEX_ANALYZER ->
indexAnalyzerProperties = (SimpleOrderedMap<Object>) fieldTypePropValue;
case FieldType.QUERY_ANALYZER ->
queryAnalyzerProperties = (SimpleOrderedMap<Object>) fieldTypePropValue;
case FieldType.MULTI_TERM_ANALYZER ->
multiTermAnalyzerProperties = (SimpleOrderedMap<Object>) fieldTypePropValue;
case FieldType.SIMILARITY ->
perFieldSimilarityProperties = (SimpleOrderedMap<Object>) fieldTypePropValue;
default -> writeAttr(fieldTypePropName, fieldTypePropValue.toString());
}
}
Expand Down Expand Up @@ -229,8 +229,8 @@ private void writeAnalyzer(SimpleOrderedMap<Object> analyzerProperties, String a
String name = analyzerProperty.getKey();
Object value = analyzerProperty.getValue();
switch (name) {
case FieldType.CHAR_FILTERS -> charFilterPropertiesList =
(List<SimpleOrderedMap<Object>>) value;
case FieldType.CHAR_FILTERS ->
charFilterPropertiesList = (List<SimpleOrderedMap<Object>>) value;
case FieldType.TOKENIZER -> tokenizerProperties = (SimpleOrderedMap<Object>) value;
case FieldType.FILTERS -> filterPropertiesList = (List<SimpleOrderedMap<Object>>) value;
case FieldType.CLASS_NAME -> {
Expand Down
2 changes: 1 addition & 1 deletion solr/core/src/java/org/apache/solr/schema/BBoxField.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ protected DoubleValuesSource getValueSourceFromSpatialArgs(
}

switch (scoreParam) {
// TODO move these to superclass after LUCENE-5804 ?
// TODO move these to superclass after LUCENE-5804 ?
case OVERLAP_RATIO:
double queryTargetProportion = 0.25; // Suggested default; weights towards target area

Expand Down
55 changes: 31 additions & 24 deletions solr/core/src/java/org/apache/solr/schema/DenseVectorField.java
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,13 @@ public SortField getSortField(SchemaField field, boolean top) {

private Query getSeededQuery(Query knnQuery, Query seed) {
return switch (knnQuery) {
case SolrKnnFloatVectorQuery knnFloatQuery -> SeededKnnVectorQuery.fromFloatQuery(
knnFloatQuery, seed);
case SolrKnnByteVectorQuery knnByteQuery -> SeededKnnVectorQuery.fromByteQuery(
knnByteQuery, seed);
default -> throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR, "Invalid type of knn query");
case SolrKnnFloatVectorQuery knnFloatQuery ->
SeededKnnVectorQuery.fromFloatQuery(knnFloatQuery, seed);
case SolrKnnByteVectorQuery knnByteQuery ->
SeededKnnVectorQuery.fromByteQuery(knnByteQuery, seed);
default ->
throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR, "Invalid type of knn query");
};
}

Expand All @@ -606,24 +607,30 @@ private Query getEarlyTerminationQuery(Query knnQuery, EarlyTerminationParams ea
(earlyTermination.getSaturationThreshold() != null
&& earlyTermination.getPatience() != null);
return switch (knnQuery) {
case SolrKnnFloatVectorQuery knnFloatQuery -> useExplicitParams
? PatienceKnnVectorQuery.fromFloatQuery(
knnFloatQuery,
earlyTermination.getSaturationThreshold(),
earlyTermination.getPatience())
: PatienceKnnVectorQuery.fromFloatQuery(knnFloatQuery);
case SolrKnnByteVectorQuery knnByteQuery -> useExplicitParams
? PatienceKnnVectorQuery.fromByteQuery(
knnByteQuery,
earlyTermination.getSaturationThreshold(),
earlyTermination.getPatience())
: PatienceKnnVectorQuery.fromByteQuery(knnByteQuery);
case SeededKnnVectorQuery seedQuery -> useExplicitParams
? PatienceKnnVectorQuery.fromSeededQuery(
seedQuery, earlyTermination.getSaturationThreshold(), earlyTermination.getPatience())
: PatienceKnnVectorQuery.fromSeededQuery(seedQuery);
default -> throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR, "Invalid type of knn query");
case SolrKnnFloatVectorQuery knnFloatQuery ->
useExplicitParams
? PatienceKnnVectorQuery.fromFloatQuery(
knnFloatQuery,
earlyTermination.getSaturationThreshold(),
earlyTermination.getPatience())
: PatienceKnnVectorQuery.fromFloatQuery(knnFloatQuery);
case SolrKnnByteVectorQuery knnByteQuery ->
useExplicitParams
? PatienceKnnVectorQuery.fromByteQuery(
knnByteQuery,
earlyTermination.getSaturationThreshold(),
earlyTermination.getPatience())
: PatienceKnnVectorQuery.fromByteQuery(knnByteQuery);
case SeededKnnVectorQuery seedQuery ->
useExplicitParams
? PatienceKnnVectorQuery.fromSeededQuery(
seedQuery,
earlyTermination.getSaturationThreshold(),
earlyTermination.getPatience())
: PatienceKnnVectorQuery.fromSeededQuery(seedQuery);
default ->
throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR, "Invalid type of knn query");
};
}
}
4 changes: 2 additions & 2 deletions solr/core/src/java/org/apache/solr/search/QParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ public ValueSource parseAsValueSource() throws SyntaxError {
return switch (q) {
case null -> new LongConstValueSource(0);
case FunctionQuery functionQuery -> functionQuery.getValueSource();
case FunctionScoreQuery functionQuery -> ValueSource.fromDoubleValuesSource(
functionQuery.getSource());
case FunctionScoreQuery functionQuery ->
ValueSource.fromDoubleValuesSource(functionQuery.getSource());
default -> new QueryValueSource(q, 0.0f);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ private static Rescorer createRescorer(
final Query reRankQuery, final double reRankWeight, final ReRankOperator reRankOperator) {
assert null != reRankQuery;
return switch (reRankQuery) {
case FunctionQuery functionQuery -> new ReRankDoubleValuesSourceRescorer(
functionQuery.getValueSource().asDoubleValuesSource(), reRankWeight, reRankOperator);
case FunctionScoreQuery functionQuery -> new ReRankDoubleValuesSourceRescorer(
functionQuery.getSource(), reRankWeight, reRankOperator);
case FunctionQuery functionQuery ->
new ReRankDoubleValuesSourceRescorer(
functionQuery.getValueSource().asDoubleValuesSource(), reRankWeight, reRankOperator);
case FunctionScoreQuery functionQuery ->
new ReRankDoubleValuesSourceRescorer(
functionQuery.getSource(), reRankWeight, reRankOperator);
default -> new ReRankQueryRescorer(reRankQuery, reRankWeight, reRankOperator);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@ private static Object formatCountsVal(
// A PNG graphic; compressed. Good for large & dense heatmaps; hard to consume.
return asPngBytes(columns, rows, counts, debugInfo);

// TODO case UTFGRID https://github.com/mapbox/utfgrid-spec
// TODO case skipList: //A sequence of values; negative values are actually how many 0's to
// insert. Good for small or large but sparse heatmaps.
// TODO auto choose png or skipList; use skipList when < ~25% full or <= ~512 cells remember
// to augment error list below when we add more formats.
// TODO case UTFGRID https://github.com/mapbox/utfgrid-spec
// TODO case skipList: //A sequence of values; negative values are actually how many 0's to
// insert. Good for small or large but sparse heatmaps.
// TODO auto choose png or skipList; use skipList when < ~25% full or <= ~512 cells remember
// to augment error list below when we add more formats.
default:
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown format: " + format);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static long parseFormDataContent(
currentStream = valueStream;
break;
}
// fall-through
// fall-through
default:
currentStream.write(b);
}
Expand Down
2 changes: 1 addition & 1 deletion solr/core/src/java/org/apache/solr/update/UpdateLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ public SolrMetricsContext getSolrMetricsContext() {

private long computeBufferedOps() {
return switch (state) {
// numRecords counts header as a record
// numRecords counts header as a record
case BUFFERING -> (bufferTlog == null ? 0 : bufferTlog.numRecords() - 1);
case APPLYING_BUFFERED -> {
if (tlog == null) yield 0;
Expand Down
6 changes: 3 additions & 3 deletions solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ public void testCreateDelete() throws Exception {
try {
switch (random().nextInt(3)) {
case 0 ->
// Sometimes use SolrJ
CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1, 0, 3)
.process(cluster.getSolrClient());
// Sometimes use SolrJ
CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1, 0, 3)
.process(cluster.getSolrClient());
case 1 -> {
// Sometimes use v1 API
var jetty = cluster.getRandomJetty(random());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ public void accept(Mutable arg0) {

@Test
public void testGetMetricsCategoryParams() throws IOException {
String expected = """
String expected =
"""
category="QUERY"
""";

Expand Down
Loading
Loading