FilterAndSortCandidates returns all on empty query

Previously it returned an empty list. It makes mores sense to return the input
list of candidates because conceptually everything matches an empty query.
This commit is contained in:
Strahinja Val Markovic 2013-04-20 13:27:55 -07:00
parent 6d0c736d04
commit c3b7e55762

View File

@ -64,8 +64,18 @@ boost::python::list FilterAndSortCandidates(
const std::string &query ) { const std::string &query ) {
pylist filtered_candidates; pylist filtered_candidates;
if ( query.empty() ) if ( query.empty() ) {
if ( candidate_property.empty() )
return candidates;
int num_candidates = len( candidates );
for ( int i = 0; i < num_candidates; ++i ) {
filtered_candidates.append( candidates[ i ][ candidate_property ] );
}
return filtered_candidates; return filtered_candidates;
}
std::vector< const Candidate * > repository_candidates = std::vector< const Candidate * > repository_candidates =
CandidatesFromObjectList( candidates, candidate_property ); CandidatesFromObjectList( candidates, candidate_property );