Items without rows in the applicable table didn't show up for searches with isNot or doesNotContain conditions

This commit is contained in:
Dan Stillman 2006-08-20 07:34:37 +00:00
parent 04d05548b2
commit d193afe740

View file

@ -289,7 +289,14 @@ Scholar.Search.prototype._buildQuery = function(){
case 'savedSearches':
break;
default:
condSQL += 'itemID IN (SELECT itemID FROM ' + i + ' WHERE (';
condSQL += 'itemID '
switch (tables[i][j]['operator']){
case 'isNot':
case 'doesNotContain':
condSQL += 'NOT ';
break;
}
condSQL += 'IN (SELECT itemID FROM ' + i + ' WHERE (';
openParens = 2;
}
@ -366,25 +373,17 @@ Scholar.Search.prototype._buildQuery = function(){
condSQL += tables[i][j]['field'];
switch (tables[i][j]['operator']){
case 'contains':
case 'doesNotContain': // excluded with NOT IN above
condSQL += ' LIKE ?';
condSQLParams.push('%' + tables[i][j]['value'] + '%');
break;
case 'doesNotContain':
condSQL += ' NOT LIKE ?';
condSQLParams.push('%' + tables[i][j]['value'] + '%');
break;
case 'is':
case 'isNot': // excluded with NOT IN above
condSQL += '=?';
condSQLParams.push(tables[i][j]['value']);
break;
case 'isNot':
condSQL += '!=?';
condSQLParams.push(tables[i][j]['value']);
break;
case 'greaterThan':
condSQL += '>?';
condSQLParams.push({int:tables[i][j]['value']});