Author: jflesch
Date: 2006-10-25 22:42:36 +0000 (Wed, 25 Oct 2006)
New Revision: 10707
Modified:
trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java
trunk/apps/Thaw/src/thaw/plugins/index/SearchResult.java
Log:
If no index is selected, do the search on all the files and all the links
Modified: trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java 2006-10-24
11:32:09 UTC (rev 10706)
+++ trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java 2006-10-25
22:42:36 UTC (rev 10707)
@@ -57,9 +57,6 @@
if (this.userText.getText() == null)
return;
- if (this.tree.getSelectedNode() == null)
- return;
-
this.userText.setSelectionStart(0);
this.userText.setSelectionEnd(this.userText.getText().length());
Modified: trunk/apps/Thaw/src/thaw/plugins/index/SearchResult.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/SearchResult.java 2006-10-24
11:32:09 UTC (rev 10706)
+++ trunk/apps/Thaw/src/thaw/plugins/index/SearchResult.java 2006-10-25
22:42:36 UTC (rev 10707)
@@ -27,7 +27,10 @@
public SearchResult(Hsqldb hsqldb, String search, IndexTreeNode node,
FCPQueueManager queueManager) {
this.queueManager = queueManager;
this.search = search.split(" ");
- this.indexIds = node.getIndexIds();
+ if (node == null)
+ this.indexIds = null;
+ else
+ this.indexIds = node.getIndexIds();
this.db = hsqldb;
}
@@ -36,16 +39,22 @@
String query = "";
PreparedStatement st;
- query = "SELECT "+fields+" FROM "+table+" WHERE (FALSE";
+ query = "SELECT "+fields+" FROM "+table +" WHERE ";
- for (Iterator it = indexIds.iterator();
- it.hasNext();) {
- it.next();
- query = query + " OR indexParent = ?";
+ if (indexIds != null) {
+ query = query +"(FALSE";
+
+ for (Iterator it = indexIds.iterator();
+ it.hasNext();) {
+ it.next();
+ query = query + " OR indexParent = ?";
+ }
+
+ query = query + ") AND ";
}
+
+ query = query + "(TRUE";
- query = query + ") AND (TRUE";
-
for (int i = 0 ; i < searchPatterns.length; i++) {
query = query + " AND LOWER(publicKey) LIKE ?";
}
@@ -66,9 +75,11 @@
i = 1;
- for (Iterator it = indexIds.iterator();
- it.hasNext(); i++) {
- st.setInt(i, ((Integer)it.next()).intValue());
+ if (indexIds != null) {
+ for (Iterator it = indexIds.iterator();
+ it.hasNext(); i++) {
+ st.setInt(i, ((Integer)it.next()).intValue());
+ }
}
for (int j = 0 ; j < searchPatterns.length; j++) {