From 7cbbb5975eb57288e7ba908231161e28b8eb1461 Mon Sep 17 00:00:00 2001 From: Randy Baumgarte Date: Wed, 5 Jan 2011 18:41:19 -0500 Subject: [PATCH] Added "stack:" to supported search terms. --- src/cx/fbn/nevernote/sql/REnSearch.java | 34 ++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/cx/fbn/nevernote/sql/REnSearch.java b/src/cx/fbn/nevernote/sql/REnSearch.java index b2b4e44..7668f25 100644 --- a/src/cx/fbn/nevernote/sql/REnSearch.java +++ b/src/cx/fbn/nevernote/sql/REnSearch.java @@ -55,6 +55,7 @@ public class REnSearch { private final List sourceApplication; private final List recoType; private final List todo; + private final List stack; private final List tagIndex; private final ApplicationLogger logger; // private final DatabaseConnection db; @@ -85,6 +86,7 @@ public class REnSearch { recoType = new ArrayList(); todo = new ArrayList(); any = false; + stack = new ArrayList(); if (s == null) return; @@ -110,7 +112,7 @@ public class REnSearch { public List getCreated() { return created; } public List getUpdated() { return updated; } public List getSubjectDate() { return subjectDate; } - + public List getStack() { return stack; } // match tag names private boolean matchTagsAll(List tagNames) { @@ -196,6 +198,28 @@ public class REnSearch { return matchListAll(getNotebooks(), name); } // Match notebooks in search terms against notes + private boolean matchNotebookStack(String guid) { + if (getStack().size() == 0) + return true; + NotebookTable bookTable = new NotebookTable(logger, conn); + List books = bookTable.getAll(); + + String name = new String(""); + for (int i=0; i list, String title) { if (list.size() == 0) return true; @@ -411,6 +435,10 @@ public class REnSearch { todo.add(word); if (word.startsWith("-todo:")) todo.add(word); + if (word.startsWith("stack:")) + stack.add(word); + if (word.startsWith("-stack:")) + stack.add(word); if (word.startsWith("latitude:")) latitude.add(word); @@ -731,6 +759,8 @@ public class REnSearch { good = false; if (good && !matchNotebook(n.getNotebookGuid())) good = false; + if (good && !matchNotebookStack(n.getNotebookGuid())) + good = false; if (good && !matchListAny(getIntitle(), n.getTitle())) good = false; if (good && !matchListAny(getAuthor(), n.getAttributes().getAuthor())) @@ -752,6 +782,8 @@ public class REnSearch { good = false; if (good && !matchNotebook(n.getNotebookGuid())) good = false; + if (good && !matchNotebookStack(n.getNotebookGuid())) + good = false; if (good && !matchListAll(getIntitle(), n.getTitle())) good = false; if (good && !matchListAll(getAuthor(), n.getAttributes().getAuthor())) -- 2.11.0