compute proposals for blank strings
Before we would only provide proposals for empty strings. But blank and empty is not that different.
This commit is contained in:
@@ -6,6 +6,7 @@ import java.util.Map.Entry;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.lucares.pdb.datastore.Proposal;
|
||||
import org.lucares.pdb.datastore.lang.ProposerParser;
|
||||
import org.lucares.utils.CollectionUtils;
|
||||
@@ -21,7 +22,7 @@ public class Proposer {
|
||||
public List<Proposal> propose(final String query, final int caretIndex) {
|
||||
final SortedSet<Proposal> result;
|
||||
|
||||
if (query.isEmpty()) {
|
||||
if (StringUtils.isBlank(query)) {
|
||||
result = proposeForAllKeys();
|
||||
} else {
|
||||
result = ProposerParser.parse(query, dataStore, caretIndex);
|
||||
|
||||
@@ -67,6 +67,12 @@ public class ProposerTest {
|
||||
new Proposal("bird", "bird=*", 3), //
|
||||
new Proposal("dog", "dog=*", 2)//
|
||||
);
|
||||
|
||||
assertProposals(" ", 1, //
|
||||
new Proposal("name", "name=*", 5), //
|
||||
new Proposal("bird", "bird=*", 3), //
|
||||
new Proposal("dog", "dog=*", 2)//
|
||||
);
|
||||
}
|
||||
|
||||
public void testPrefixOfKey() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user