aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-01-16 21:57:42 -0800
committerScott Jackson <daneren2005@gmail.com>2013-01-16 21:57:42 -0800
commit6694a918ed25ebe3ba3e6c8559f27914cc61c1c7 (patch)
tree6eaf1e4e117a3d2d4ec93ae916f8c61d8f311c94
parentbe2e9e1591ae7bd2a3c144124d1ed82237cfcabf (diff)
downloaddsub-6694a918ed25ebe3ba3e6c8559f27914cc61c1c7.tar.gz
dsub-6694a918ed25ebe3ba3e6c8559f27914cc61c1c7.tar.bz2
dsub-6694a918ed25ebe3ba3e6c8559f27914cc61c1c7.zip
Offline search match by words so something like "I ..." doesn't return everything under the sun
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
index 21bce39c..753f6016 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -227,12 +227,14 @@ public class OfflineMusicService extends RESTMusicService {
}
private boolean matchCriteria(SearchCritera criteria, String name) {
String query = criteria.getQuery().toLowerCase();
- String[] parts = query.split(" ");
- name = name.toLowerCase();
+ String[] queryParts = query.split(" ");
+ String[] nameParts = name.toLowerCase().split(" ");
- for(String part : parts) {
- if(name.indexOf(part) != -1) {
- return true;
+ for(String queryPart : queryParts) {
+ for(String namePart : nameParts) {
+ if(namePart.equals(queryPart)) {
+ return true;
+ }
}
}