diff --git a/src/query/plaintorich.cpp b/src/query/plaintorich.cpp index f559030b..30bed741 100644 --- a/src/query/plaintorich.cpp +++ b/src/query/plaintorich.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include @@ -29,6 +29,7 @@ using std::vector; using std::list; using std::pair; using std::set; +using std::unordered_map; #include "rcldb.h" #include "rclconfig.h" @@ -123,8 +124,8 @@ private: const HighlightData& m_hdata; // group/near terms word positions. - map > m_plists; - map > m_gpostobytes; + unordered_map > m_plists; + unordered_map > m_gpostobytes; }; diff --git a/src/rcldb/rclabsfromtext.cpp b/src/rcldb/rclabsfromtext.cpp index 73acac50..a19ef9c5 100644 --- a/src/rcldb/rclabsfromtext.cpp +++ b/src/rcldb/rclabsfromtext.cpp @@ -18,7 +18,6 @@ #include -#include #include #include #include @@ -270,8 +269,7 @@ public: // After the text is split: use the group terms positions lists to - // find the group matches. We process everything as NEAR (no - // PHRASE specific processing). + // find the group matches. void updgroups() { LOGDEB("TextSplitABS: stored total " << m_fragments.size() << " fragments" << endl); @@ -361,8 +359,8 @@ private: // Group terms, extracted from m_hdata unordered_set m_gterms; // group/near terms word positions. - map > m_plists; - map > m_gpostobytes; + unordered_map > m_plists; + unordered_map > m_gpostobytes; // Input unordered_set m_terms; diff --git a/src/testmains/trhldata.cpp b/src/testmains/trhldata.cpp index dcfbde29..80f2127e 100644 --- a/src/testmains/trhldata.cpp +++ b/src/testmains/trhldata.cpp @@ -81,9 +81,9 @@ public: // Data: source text (for display), string text1{"0 1 2 3 4"}; // Positions produced by textsplit -d from the above -map > plists1 +unordered_map > plists1 {{"0", {0,}}, {"1", {1,}}, {"2", {2,}}, {"3", {3,}}, {"4", {4,}}, }; -map> gpostobytes1 +unordered_map> gpostobytes1 {{0, {0, 1}}, {1, {2, 3}}, {2, {4, 5}}, {3, {6, 7}}, {4, {8, 9}}, }; diff --git a/src/utils/hldata.cpp b/src/utils/hldata.cpp index e0f0493d..e3738c20 100644 --- a/src/utils/hldata.cpp +++ b/src/utils/hldata.cpp @@ -1,17 +1,20 @@ -/* Copyright (C) 2016 J.F.Dockes - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. +/* Copyright (C) 2017-2019 J.F.Dockes * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * License: GPL 2.1 * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "autoconfig.h" @@ -25,7 +28,7 @@ #include "smallut.h" using std::string; -using std::map; +using std::unordered_map; using std::vector; using std::pair; @@ -169,8 +172,8 @@ static bool do_proximity_test( // Find matches for one group of terms bool matchGroup(const HighlightData& hldata, unsigned int grpidx, - const map>& inplists, - const map>& gpostobytes, + const unordered_map>& inplists, + const unordered_map>& gpostobytes, vector& tboffs) { diff --git a/src/utils/hldata.h b/src/utils/hldata.h index e4e54369..48cd5b6b 100644 --- a/src/utils/hldata.h +++ b/src/utils/hldata.h @@ -1,10 +1,28 @@ +/* Copyright (C) 2017-2019 J.F.Dockes + * + * License: GPL 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ #ifndef _hldata_h_included_ #define _hldata_h_included_ #include #include #include -#include #include /** Store data about user search terms and their expansions. This is used @@ -84,16 +102,17 @@ struct GroupMatchEntry { } }; -// Find NEAR matches for one group of terms. +// Find NEAR or PHRASE matches for one group of terms. // // @param hldata User query expansion descriptor (see above). We only use // the index_term_groups entry // // @param grpidx Index in hldata.index_term_groups for the group we -// process. This is used by us to get the terms and slacks, and -// set in the output GroupMatchEntry structures to allow the -// caller to link a match with a specific user input (e.g. for -// walking the match in the GUI preview) +// process. This is used by us to get the terms, group type +// (phrase/near) and slacks. We also set it in the output +// GroupMatchEntry structures to allow the caller to link a match +// with a specific user input (e.g. for walking the match in the +// GUI preview) // // @param inplists Position lists for the the group terms. This is the // data used to look for matches. @@ -108,8 +127,8 @@ struct GroupMatchEntry { extern bool matchGroup( const HighlightData& hldata, unsigned int grpidx, - const std::map>& inplists, - const std::map>& gpostobytes, + const std::unordered_map>& inplists, + const std::unordered_map>& gpostobytes, std::vector& tboffs );