Commit d37a30e3 authored by Jean-Baptiste Nizet's avatar Jean-Baptiste Nizet
Browse files

fix: fix query and add missing test

parent a31bacfc
......@@ -121,7 +121,7 @@ public class GermplasmRepositoryImpl implements GermplasmRepository {
@Override
public Iterator<GermplasmMcpdVO> scrollGermplasmMcpdsByIds(Set<String> ids, int fetchSize) {
QueryBuilder query = QueryBuilders.idsQuery().addIds(ids.toArray(new String[0]));
QueryBuilder query = QueryBuilders.termsQuery("germplasmDbId", ids);
return new ESScrollIterator<>(client, requestFactory, parser, GermplasmMcpdVO.class, query, fetchSize);
}
......
......@@ -52,7 +52,6 @@ class GermplasmRepositoryTest {
esSetUp.initialize(ProgenyVO.class, 0L);
esSetUp.initialize(PedigreeVO.class, 0L);
esSetUp.initialize(GermplasmMcpdVO.class, 0L);
}
@Autowired
......@@ -137,6 +136,22 @@ class GermplasmRepositoryTest {
.allMatch(vo -> !vo.getGermplasmDbId().isEmpty());
}
@Test
void shouldScrollGermplasmMcpdsByIds() {
Iterator<GermplasmMcpdVO> list = repository.scrollGermplasmMcpdsByIds(Collections.singleton("13705"), 1000);
assertThat(list).toIterable()
.isNotEmpty()
.allMatch(vo -> !vo.getGermplasmDbId().isEmpty());
list = repository.scrollGermplasmMcpdsByIds(Collections.singleton("1370"), 1000);
assertThat(list).toIterable()
.isEmpty();
list = repository.scrollGermplasmMcpdsByIds(Collections.singleton("Prunus"), 1000);
assertThat(list).toIterable()
.isEmpty();
}
@Test
void should_Scroll_By_accessionNumber() {
GermplasmPOSTSearchCriteria criteria = new GermplasmPOSTSearchCriteria();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment