wikipathways / cytoscape-wikipathways-app

WikiPathways app for Cytoscape to open and access pathways from WikiPathways
Apache License 2.0
5 stars 7 forks source link

Support for AND searches #36

Closed AlexanderPico closed 6 years ago

AlexanderPico commented 6 years ago

Interestingly, if you use "AND" in queries made directly to the webservice, the operator is used, e.g., only 7 results for Human from "tp53 AND atm AND brca1": http://webservice.wikipathways.org/findPathwaysByText?query=tp53%20AND%20atm%20AND%20brca1&species=Homo%20sapiens&format=xml

But, if you do the same query through the app, the operator is ignored and an "OR" result is returned, i.e., >60 results for Human. The code appears to be constructing the same query as above, so I'm not sure why this isn't working... https://github.com/wikipathways/cytoscape-wikipathways-app/blob/3.2.1/src/main/java/org/wikipathways/cytoscapeapp/impl/WPClientRESTImpl.java#L231

AlexanderPico commented 6 years ago

Ah, I do know why...

query.toLowerCase()

This effectively removes the AND operators, which must be in all caps. Do we need to lower case queries? If not, try removing that function. If so, then make a function that lowercases all words except AND and NOT, or replace these with && and ! prior to lowercasing.

AdamStuart commented 6 years ago

WPClientRESTImpl .newFreeTextSearchTask #232 String lower = query.toLowerCase(); String fix1 = lower.replace(" and ", " AND "); String fixed = fix1.replace(" or ", " OR ");

AlexanderPico commented 6 years ago

Not seeing it... https://github.com/wikipathways/cytoscape-wikipathways-app/blob/newBranch/src/main/java/org/wikipathways/cytoscapeapp/impl/WPClientRESTImpl.java#L231

AlexanderPico commented 6 years ago

got it