diff --git a/app/src/main/java/uk/ac/ebi/atlas/solr/SingleCellSolrUtils.java b/app/src/main/java/uk/ac/ebi/atlas/solr/SingleCellSolrUtils.java index 53585e44d..0f23e3fd8 100644 --- a/app/src/main/java/uk/ac/ebi/atlas/solr/SingleCellSolrUtils.java +++ b/app/src/main/java/uk/ac/ebi/atlas/solr/SingleCellSolrUtils.java @@ -45,6 +45,7 @@ public ImmutableSet fetchedRandomOrganismPartsByCellIDs(ImmutableSet queryBuilder = new SolrQueryBuilder<>(); queryBuilder .addQueryFieldByTerm(CELL_ID, cellIDs) + .exists(CTW_CELL_TYPE) .setFieldList(CTW_ORGANISM_PART) .setRows(MAX_ROWS); diff --git a/app/src/test/java/uk/ac/ebi/atlas/search/celltype/CellTypeSearchDaoIT.java b/app/src/test/java/uk/ac/ebi/atlas/search/celltype/CellTypeSearchDaoIT.java index 700f7a1ae..67fe1337e 100644 --- a/app/src/test/java/uk/ac/ebi/atlas/search/celltype/CellTypeSearchDaoIT.java +++ b/app/src/test/java/uk/ac/ebi/atlas/search/celltype/CellTypeSearchDaoIT.java @@ -19,7 +19,6 @@ import javax.inject.Inject; import javax.sql.DataSource; - import java.util.HashSet; import static org.assertj.core.api.Assertions.assertThat; @@ -183,8 +182,8 @@ void whenValidCellIdsAndValidProvidedReturnSetOfCellTypes() { var randomListOfCellIDs = ImmutableSet.copyOf( new HashSet<>(jdbcUtils.fetchRandomListOfCells(3))); - ImmutableSet organismParts = solrUtils.fetchedRandomOrganismPartsByCellIDs( - randomListOfCellIDs, 1); + var organismParts = solrUtils.fetchedRandomOrganismPartsByCellIDs( + randomListOfCellIDs, 1); var cellTypes = subject.searchCellTypes(randomListOfCellIDs, organismParts);