Differentiate between formatted and preview text

pull/174/head
M66B 5 years ago
parent ffebe78922
commit fe35cc0c1e

@ -252,7 +252,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
if (file.exists()) { if (file.exists()) {
String html = Helper.readText(file); String html = Helper.readText(file);
if (html.toLowerCase(Locale.ROOT).contains(find)) { if (html.toLowerCase(Locale.ROOT).contains(find)) {
String text = HtmlHelper.getText(html); String text = HtmlHelper.getPreviewText(html);
if (text.toLowerCase(Locale.ROOT).contains(find)) if (text.toLowerCase(Locale.ROOT).contains(find))
match.matched = true; match.matched = true;
} }

@ -3213,7 +3213,7 @@ class Core {
String text = null; String text = null;
try { try {
String html = Helper.readText(message.getFile(context)); String html = Helper.readText(message.getFile(context));
text = HtmlHelper.getText(html); text = HtmlHelper.getPreviewText(html);
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
text = message.preview; text = message.preview;

@ -1070,6 +1070,10 @@ public class HtmlHelper {
return preview; return preview;
} }
static String getPreviewText(String html) {
return JsoupEx.parse(html).text();
}
static String getText(String html) { static String getText(String html) {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();

@ -71,7 +71,7 @@ public class WorkerFts extends Worker {
File file = message.getFile(getApplicationContext()); File file = message.getFile(getApplicationContext());
String html = Helper.readText(file); String html = Helper.readText(file);
String text = HtmlHelper.getText(html); String text = HtmlHelper.getPreviewText(html);
try { try {
sdb.beginTransaction(); sdb.beginTransaction();
FtsDbHelper.insert(sdb, message, text); FtsDbHelper.insert(sdb, message, text);

Loading…
Cancel
Save