File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 55#include " NcbiTaxonomy.h"
66#include " MappingReader.h"
77#include " DBReader.h"
8- #include " PrefilteringIndexReader.h"
98#include " TaxonomyExpression.h"
109
1110class QueryMatcherTaxonomyHook : public QueryMatcherHook {
1211public:
1312 QueryMatcherTaxonomyHook (std::string targetPath, DBReader<unsigned int >* targetReader, const std::string& expressionString)
1413 : targetReader(targetReader), dbFrom(0 ) {
15- std::string targetName = PrefilteringIndexReader:: dbPathWithoutIndex (targetPath);
14+ std::string targetName = dbPathWithoutIndex (targetPath);
1615 taxonomy = NcbiTaxonomy::openTaxonomy (targetName);
1716 taxonomyMapping = new MappingReader (targetName);
1817 expression = new TaxonomyExpression (expressionString, *taxonomy);
@@ -44,6 +43,23 @@ class QueryMatcherTaxonomyHook : public QueryMatcherHook {
4443 return writePos;
4544 }
4645
46+ static std::string dbPathWithoutIndex (const std::string& dbname) {
47+ static const std::vector<std::string> suffices = {
48+ " _ss.idx" ,
49+ " _ss.linidx" ,
50+ " _ss" ,
51+ " .idx" ,
52+ " .linidx"
53+ };
54+ for (size_t i = 0 ; i < suffices.size (); ++i) {
55+ size_t lastpos = dbname.rfind (suffices[i]);
56+ if (lastpos != std::string::npos && dbname.size () - lastpos == suffices[i].length ()){
57+ return dbname.substr (0 , lastpos);
58+ }
59+ }
60+ return dbname;
61+ }
62+
4763 NcbiTaxonomy* taxonomy;
4864 MappingReader* taxonomyMapping;
4965 DBReader<unsigned int >* targetReader;
You can’t perform that action at this time.
0 commit comments