Skip to content

Commit

Permalink
filter out words starting with %
Browse files Browse the repository at this point in the history
  • Loading branch information
apolukhin committed Aug 8, 2023
1 parent e4dfaf1 commit 44989b7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/searchindex_js.cpp
Expand Up @@ -118,14 +118,12 @@ static StringVector splitSearchTokens(std::string str)
}

StringVector result = split(str, " ");
if (result.empty())
const auto remover = [](const auto& part)
{
return result;
}
const auto remover = [](const auto& part){
return part.size() < 4;
return part.empty() || part[0] == '%';

This comment has been minimized.

Copy link
@albert-github

albert-github Aug 8, 2023

Collaborator

Didn't test, but wouldn't it be better that the % is skipped in this case?

Or is this done in the next commits?

This comment has been minimized.

Copy link
@apolukhin

apolukhin Aug 8, 2023

Author Contributor

It could be stripped off from the word, but I'm worried about the operator%. It requires some experiments, I'd rather leave the % related changed for next time

This comment has been minimized.

Copy link
@albert-github

albert-github Aug 8, 2023

Collaborator

In principle I agree with your statement and it worries me too, though when leaving out the the complete word one doesn't find the word directly following.

};
result.erase(std::remove_if(result.begin()+1, result.end(), remover), result.end());
result.erase(std::remove_if(result.begin(),result.end(),remover),result.end());

return result;
}

Expand Down

0 comments on commit 44989b7

Please sign in to comment.