commit 4fe960d190f54b86eaf6a80d8a9e20c40e1cb2a2
parent 0061a8d0df2af92a5f4742040991a1e0b65df664
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 10 Aug 2006 04:32:36 +0000
Search updates:
- Remaining searchConditionIDs are no longer affected by removeCondition() (i.e. they now act like autoincrements), which should make interface code simpler
- Changed default join mode to ALL
- Fixed loading of saved searches with no search conditions
Diffstat:
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/xpcom/search.js b/chrome/chromeFiles/content/scholar/xpcom/search.js
@@ -27,8 +27,9 @@ Scholar.Search.prototype.setName = function(name){
*/
Scholar.Search.prototype.load = function(savedSearchID){
var sql = "SELECT savedSearchName, MAX(searchConditionID) AS maxID "
- + "FROM savedSearches NATURAL JOIN savedSearchConditions "
- + "WHERE savedSearchID=" + savedSearchID + " GROUP BY savedSearchID";
+ + "FROM savedSearches LEFT JOIN savedSearchConditions "
+ + "USING (savedSearchID) WHERE savedSearchID=" + savedSearchID
+ + " GROUP BY savedSearchID";
var row = Scholar.DB.rowQuery(sql);
if (!row){
@@ -151,16 +152,6 @@ Scholar.Search.prototype.removeCondition = function(searchConditionID){
}
delete this._conditions[searchConditionID];
-
- var i = searchConditionID + 1;
- while (typeof this._conditions[i] != 'undefined'){
- this._conditions[i-1] = this._conditions[i];
- this._conditions[i-1]['id']--;
- delete this._conditions[i];
- i++;
- }
-
- this._maxSearchConditionID--;
}
@@ -264,11 +255,12 @@ Scholar.Search.prototype._buildQuery = function(){
sql += " WHERE ";
// Join conditions using appropriate operator
- if (joinMode=='ALL'){
- var binOp = ' AND ';
+ if (joinMode=='ANY'){
+ var binOp = ' OR ';
}
+ // Default to AND
else {
- var binOp = ' OR ';
+ var binOp = ' AND ';
}
for (i in tables){