Case insensitive search without search index

pull/194/head
M66B 4 years ago
parent cbfed68c6b
commit baa471e236

@ -297,21 +297,23 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
if (state.matches.size() == 0) if (state.matches.size() == 0)
break; break;
String query = (criteria.query == null ? null : criteria.query.toLowerCase());
for (int i = state.index; i < state.matches.size() && found < pageSize && !state.destroyed; i++) { for (int i = state.index; i < state.matches.size() && found < pageSize && !state.destroyed; i++) {
state.index = i + 1; state.index = i + 1;
TupleMatch match = state.matches.get(i); TupleMatch match = state.matches.get(i);
boolean matched = (match.matched != null && match.matched); boolean matched = (match.matched != null && match.matched);
if (criteria.query != null) { if (query != null) {
if (!matched && criteria.in_message) if (!matched && criteria.in_message)
try { try {
File file = EntityMessage.getFile(context, match.id); File file = EntityMessage.getFile(context, match.id);
if (file.exists()) { if (file.exists()) {
String html = Helper.readText(file); String html = Helper.readText(file);
if (html.toLowerCase().contains(criteria.query)) { if (html.toLowerCase().contains(query)) {
String text = HtmlHelper.getFullText(html); String text = HtmlHelper.getFullText(html);
if (text.toLowerCase().contains(criteria.query)) if (text != null && text.toLowerCase().contains(query))
matched = true; matched = true;
} }
} }

Loading…
Cancel
Save