Skip to content

Commit

Permalink
HTM-1413: when there are no attributes left indexing could crash
Browse files Browse the repository at this point in the history
becasue there are no fields to copy
  • Loading branch information
mprins committed Jan 14, 2025
1 parent a0b26f1 commit d978728
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/tailormap/api/solr/SolrHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ public SearchIndex addFeatureTypeIndex(
Query q = new Query(fs.getName().toString());
// filter out any hidden properties (there should be none though)
tmFeatureType.getSettings().getHideAttributes().forEach(propertyNames::remove);
if (propertyNames.isEmpty()) {
logger.warn("No valid properties to index for featuretype: {}, bailing out.", tmFeatureType.getName());
return searchIndexRepository.save(searchIndex
.setStatus(SearchIndex.Status.ERROR)
.setSummary(summary.errorMessage("No valid properties to index")));

Check warning on line 278 in src/main/java/org/tailormap/api/solr/SolrHelper.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tailormap/api/solr/SolrHelper.java#L275-L278

Added lines #L275 - L278 were not covered by tests
}
q.setPropertyNames(List.copyOf(propertyNames));
q.setStartIndex(0);
// TODO: make maxFeatures configurable?
Expand Down

0 comments on commit d978728

Please sign in to comment.