private int getMatchScore(BookmarkInfo binfo, String keyword) { String keywordTL = keyword.toLowerCase(); int score = 0; String urlText = binfo.getUrl().toExternalForm(); if (urlText.contains(keyword)) { score += 3; } else if (urlText.toLowerCase().contains(keywordTL)) { score += 2; } String title = binfo.getTitle(); if (title != null && title.contains(keyword)) { score += 8; } else if (title != null && title.toLowerCase().contains(keywordTL)) { score += 6; } String description = binfo.getDescription(); if (description != null && description.contains(keyword)) { score += 3; } else if (description != null && description.toLowerCase().contains(keywordTL)) { score += 2; } String[] tags = binfo.getTags(); if (tags != null) { for (int i = 0; i < tags.length; i++) { if (tags[i].equals(keyword)) { score += 8; } else if (tags[i].toLowerCase().equals(keywordTL)) { score += 6; } } } return score; }