Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed suggestions for a single-word-followed-by-space query #953

Merged
merged 4 commits into from
Feb 14, 2025

Conversation

veloman-yunkan
Copy link
Collaborator

... by taking advantage of the EXPECT_SUGGESTION_RESULTS() macro
that was introduced a bit late in the history of that unit test.
A single-word query followed by a space character is mishandled by the
suggestions query parser:

- the query 'the' is parsed as

  Query((((WILDCARD SYNONYM the OR Zthe@1) OR the) OR (0posanchor PHRASE 2 the)))

- whereas the query 'the ' is parsed as

  Query(WILDCARD SYNONYM the )
I wonder why I used Xapian::Query::get_num_subqueries() instead of
Xapian::Query::empty() back in #765.
Copy link
Collaborator

@mgautierfr mgautierfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -143,7 +143,7 @@ Xapian::Query SuggestionDataBase::parseQuery(const std::string& query)
m_queryParser.set_stemming_strategy(Xapian::QueryParser::STEM_SOME);
xquery = m_queryParser.parse_query(query, flags);

if ( !query.empty() && xquery.get_num_subqueries() == 0 ) {
if ( !query.empty() && xquery.empty() ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I was not enough conscientious on the review too.

@kelson42 kelson42 merged commit 316cbd8 into main Feb 14, 2025
27 of 28 checks passed
@kelson42 kelson42 deleted the suggestions_fix branch February 14, 2025 16:21
@kelson42 kelson42 modified the milestones: 9.3.0, 10.0.0 Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing suggestion for a full word followed by a space
3 participants