summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-06-26 19:14:09 (GMT)
committerGitHub <noreply@github.com>2019-06-26 19:14:09 (GMT)
commitc44632a13d664c46b83d4a698285f530396c33b5 (patch)
tree9f2567cb20a5e3f3477c350bfd155adfd7889af3
parentd6dfcab60bf01e4deeae333a230c9bd752666efb (diff)
parent6217e3026d29a6f54e0138452706caa1bbc86307 (diff)
downloadDoxygen-c44632a13d664c46b83d4a698285f530396c33b5.zip
Doxygen-c44632a13d664c46b83d4a698285f530396c33b5.tar.gz
Doxygen-c44632a13d664c46b83d4a698285f530396c33b5.tar.bz2
Merge pull request #7075 from tirolerstefan/feature/doxysearch_wildcard
doxysearch: added wildcard, partial and phrase sesarch
-rw-r--r--addon/doxysearch/doxysearch.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/addon/doxysearch/doxysearch.cpp b/addon/doxysearch/doxysearch.cpp
index 1c4effd..ac5740b 100644
--- a/addon/doxysearch/doxysearch.cpp
+++ b/addon/doxysearch/doxysearch.cpp
@@ -367,12 +367,20 @@ int main(int argc,char **argv)
// create query
Xapian::Database db(indexDir);
Xapian::Enquire enquire(db);
- Xapian::Query query;
+
std::vector<std::string> words = split(searchFor,' ');
- for (std::vector<std::string>::const_iterator it=words.begin();it!=words.end();++it)
- {
- query = Xapian::Query(Xapian::Query::OP_OR,query,Xapian::Query(*it));
- }
+ Xapian::QueryParser parser;
+ parser.set_database(db);
+ parser.set_default_op(Xapian::Query::OP_AND);
+ parser.set_stemming_strategy(Xapian::QueryParser::STEM_ALL);
+ Xapian::termcount max_expansion=100;
+ parser.set_max_expansion(max_expansion,Xapian::Query::WILDCARD_LIMIT_MOST_FREQUENT);
+ Xapian::Query query=parser.parse_query(searchFor,
+ Xapian::QueryParser::FLAG_DEFAULT |
+ Xapian::QueryParser::FLAG_WILDCARD |
+ Xapian::QueryParser::FLAG_PHRASE |
+ Xapian::QueryParser::FLAG_PARTIAL
+ );
enquire.set_query(query);
// get results