Commit 4d532026 authored by Piotr Gawron's avatar Piotr Gawron

search by miriam returns also elements annotated automatically

parent 96a8385e
Pipeline #17952 failed with stage
in 11 minutes and 30 seconds
minerva (14.0.6) stable; urgency=medium
* Bug fix: opening map with no background overlays and search request in url
provides proper error message (#1046)
* Bug fix: search by identifier didn't consider identifiers added by
annotators (#1047)
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 18 Dec 2019 12:00:00 +0200
minerva (14.0.5) stable; urgency=medium
* Bug fix: copy-paste of genetic-variant data overlay into Add overlay
......
......@@ -344,7 +344,8 @@ public class ModelFullIndexed implements Model {
Set<BioEntity> result = new HashSet<>();
for (Element element : getElements()) {
for (MiriamData md : element.getMiriamData()) {
if (md.equals(miriamData)) {
if (Objects.equals(md.getResource(), miriamData.getResource())
&& Objects.equals(md.getDataType(), miriamData.getDataType())) {
result.add(element);
}
}
......@@ -352,7 +353,8 @@ public class ModelFullIndexed implements Model {
for (Reaction element : getReactions()) {
for (MiriamData md : element.getMiriamData()) {
if (md.equals(miriamData)) {
if (Objects.equals(md.getResource(), miriamData.getResource())
&& Objects.equals(md.getDataType(), miriamData.getDataType())) {
result.add(element);
}
}
......
......@@ -115,6 +115,16 @@ public class ModelTest extends ModelTestFunctions {
assertEquals(0, elements.size());
}
@Test
public void testElementsByAnnotationWithAnnotator() {
model = createModel();
Set<BioEntity> elements = model
.getElementsByAnnotation(new MiriamData(MiriamType.CHEMBL_TARGET, "CHEMBL12345", Object.class));
assertNotNull(elements);
assertEquals(1, elements.size());
}
private Model createModel() {
Model model = new ModelFullIndexed(null);
......
......@@ -54,7 +54,7 @@ public class SearchService implements ISearchService {
* Default class logger.
*/
@SuppressWarnings("unused")
private static Logger logger = LogManager.getLogger(SearchService.class.getName());
private static Logger logger = LogManager.getLogger();
/**
* Data access object for models.
......@@ -91,7 +91,7 @@ public class SearchService implements ISearchService {
* between String and List is stored. The key in this map is incomplete typed
* word, and value list contains suggestions that should appear for this word.
*/
private Map<Model, Map<String, List<String>>> autoCompleteLists = new HashMap<Model, Map<String, List<String>>>();
private Map<Model, Map<String, List<String>>> autoCompleteLists = new HashMap<>();
/**
* Default constructor that set list of prefixes used in the search queries.
......
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