From cbcefc1517062258ac454bd4afef1ca220bc3398 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 21 Sep 2022 09:32:32 +0200 Subject: [PATCH] Make sure that a single double quoted word (single-word phrase) is not stem-expanded as this is unexpected --- src/rcldb/searchdatatox.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rcldb/searchdatatox.cpp b/src/rcldb/searchdatatox.cpp index 27beba0b..e088a2f1 100644 --- a/src/rcldb/searchdatatox.cpp +++ b/src/rcldb/searchdatatox.cpp @@ -808,9 +808,8 @@ bool SearchDataClauseSimple::processUserString( if (o_index_stripchars) nxt = &tpprep; - TextSplitQ splitter(TextSplit::Flags(TextSplit::TXTS_ONLYSPANS | - TextSplit::TXTS_KEEPWILD), - nxt); + TextSplitQ splitter(TextSplit::Flags( + TextSplit::TXTS_ONLYSPANS | TextSplit::TXTS_KEEPWILD), nxt); tpq.setTSQ(&splitter); splitter.text_to_words(wordorphrase); @@ -1074,6 +1073,11 @@ bool SearchDataClauseDist::toNativeQuery(Rcl::Db &db, void *p) } string s = cstr_dquote + m_text + cstr_dquote; bool useNear = (m_tp == SCLT_NEAR); + if (!useNear) { + // We are a phrase query. Make sure to disable stemming explicitely in case this is a single + // quoted word because processUserString won't see it as a phrase by itself. + m_modifiers |= SDCM_NOSTEMMING; + } if (!processUserString(db, s, m_reason, &pqueries, m_slack, useNear)) return false; if (pqueries.empty()) {