Go back to winner-takes-all lib-tree scoring algorithm.

(Because we sort alphabetically there's no way to see
what the second-highest scored item was.)
This commit is contained in:
Jeff Young
2023-04-30 13:01:09 +01:00
parent af7753c7cd
commit bc754df30f
4 changed files with 99 additions and 10 deletions
+22
View File
@@ -399,6 +399,28 @@ EDA_COMBINED_MATCHER::EDA_COMBINED_MATCHER( const wxString& aPattern,
}
bool EDA_COMBINED_MATCHER::Find( const wxString& aTerm, int& aMatchersTriggered, int& aPosition )
{
aPosition = EDA_PATTERN_NOT_FOUND;
aMatchersTriggered = 0;
for( const std::unique_ptr<EDA_PATTERN_MATCH>& matcher : m_matchers )
{
EDA_PATTERN_MATCH::FIND_RESULT local_find = matcher->Find( aTerm );
if( local_find )
{
aMatchersTriggered += 1;
if( local_find.start < aPosition || aPosition == EDA_PATTERN_NOT_FOUND )
aPosition = local_find.start;
}
}
return aPosition != EDA_PATTERN_NOT_FOUND;
}
bool EDA_COMBINED_MATCHER::Find( const wxString& aTerm )
{
for( const std::unique_ptr<EDA_PATTERN_MATCH>& matcher : m_matchers )