Skip to content

Commit

Permalink
Issue #731 Metabolic pathways - species fix (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
okolesn authored Mar 28, 2022
1 parent 84e95a3 commit f75dfe2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public class PathwayQueryParams {
private PagingInfo pagingInfo;
private String term;
private PathwayDatabaseSource databaseSource;
private String species;
private Long taxId;
private SortInfo sortInfo;
}
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,9 @@ private List<PathwayOrganism> getOrganisms(final Document doc) {

private Query buildPathwaySearchQuery(final PathwayQueryParams params) throws ParseException {
final String term = params.getTerm();
final String species = params.getSpecies();
final Long taxId = params.getTaxId();
final PathwayDatabaseSource source = params.getDatabaseSource();
if (TextUtils.isBlank(term) && TextUtils.isBlank(species) && source == null) {
if (TextUtils.isBlank(term) && taxId == null && source == null) {
return new MatchAllDocsQuery();
}

Expand All @@ -478,8 +478,8 @@ private Query buildPathwaySearchQuery(final PathwayQueryParams params) throws Pa
builder.add(termBuilder.build(), BooleanClause.Occur.MUST);
}

if (!TextUtils.isBlank(species)) {
builder.add(buildQuery(PathwayIndexFields.SPECIES.getFieldName(), species, analyzer),
if (taxId != null) {
builder.add(buildQuery(PathwayIndexFields.SPECIES.getFieldName(), String.valueOf(taxId), analyzer),
BooleanClause.Occur.MUST);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public void loadPathways() throws IOException, ParseException {
final PathwayQueryParams parameters = new PathwayQueryParams();
final PagingInfo pagingInfo = new PagingInfo(2, 1);
parameters.setPagingInfo(pagingInfo);
parameters.setTaxId(1L);
final Page<NGBPathway> pathways = pathwayManager.loadPathways(parameters);
pathwayManager.deletePathway(pathway.getPathwayId());
pathwayManager.deletePathway(pathway1.getPathwayId());
Expand Down

0 comments on commit f75dfe2

Please sign in to comment.