From 6694a918ed25ebe3ba3e6c8559f27914cc61c1c7 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 16 Jan 2013 21:57:42 -0800 Subject: Offline search match by words so something like "I ..." doesn't return everything under the sun --- .../github/daneren2005/dsub/service/OfflineMusicService.java | 12 +++++++----- 1 file 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; + } } } -- cgit v1.2.3