www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 318cf3194f4104f70f0affb4e2eb06400708522f
parent 6efd6d2cc42d65bab7c462156643e2856b11e103
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue,  8 Aug 2006 23:08:52 +0000

Addresses #171, Add more conditions to advanced search architecture

Added conditions 'tagID', 'tag' (text), 'creator' (concats first and last before comparing), and 'note'


Diffstat:
Mchrome/chromeFiles/content/scholar/xpcom/search.js | 70+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 67 insertions(+), 3 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/xpcom/search.js b/chrome/chromeFiles/content/scholar/xpcom/search.js @@ -273,7 +273,9 @@ Scholar.Search.prototype._buildQuery = function(){ for (i in tables){ for (var j in tables[i]){ + // // Special table handling + // switch (i){ case 'items': break; @@ -282,10 +284,28 @@ Scholar.Search.prototype._buildQuery = function(){ var openParens = 2; } + + // + // Special field handling + // + // For itemData fields, include fieldID - if (tables[i][j]['name']=='field'){ - sql += 'fieldID=? AND '; - sqlParams.push(Scholar.ItemFields.getID(tables[i][j]['alias'])); + switch (tables[i][j]['name']){ + case 'field': + sql += 'fieldID=? AND '; + sqlParams.push( + Scholar.ItemFields.getID(tables[i][j]['alias']) + ); + break; + case 'tag': + sql += "tagID IN (SELECT tagID FROM tags WHERE "; + openParens++; + break; + case 'creator': + sql += "creatorID IN (SELECT creatorID FROM creators " + + "WHERE "; + openParens++; + break; } sql += tables[i][j]['field']; @@ -487,6 +507,50 @@ Scholar.SearchConditions = new function(){ }, { + name: 'tagID', + operators: { + is: true, + isNot: true + }, + table: 'itemTags', + field: 'tagID' + }, + + { + name: 'tag', + operators: { + is: true, + isNot: true, + contains: true, + doesNotContain: true + }, + table: 'itemTags', + field: 'tag' + }, + + { + name: 'note', + operators: { + contains: true, + doesNotContain: true + }, + table: 'itemNotes', + field: 'note' + }, + + { + name: 'creator', + operators: { + is: true, + isNot: true, + contains: true, + doesNotContain: true + }, + table: 'itemCreators', + field: "firstName || ' ' || lastName" + }, + + { name: 'field', operators: { is: true,