split search keywords by whitespaces and imply AND operatior
This commit is contained in:
parent
e30e84c819
commit
252c7e68d6
|
@ -149,8 +149,18 @@ public class Contact implements ListItem {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
needle = needle.toLowerCase();
|
needle = needle.toLowerCase();
|
||||||
|
String[] parts = needle.split("\\s+");
|
||||||
|
if (parts.length > 1) {
|
||||||
|
for(int i = 0; i < parts.length; ++i) {
|
||||||
|
if (!match(parts[i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
return jid.toString().contains(needle) || getDisplayName().toLowerCase().contains(needle) || matchInTag(needle);
|
return jid.toString().contains(needle) || getDisplayName().toLowerCase().contains(needle) || matchInTag(needle);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean matchInTag(String needle) {
|
private boolean matchInTag(String needle) {
|
||||||
for (Tag tag : getTags()) {
|
for (Tag tag : getTags()) {
|
||||||
|
|
Loading…
Reference in a new issue