Fix quick search and quick format bar (broken in 9b247ebba7
)
As evidenced by majorly failing tests
This commit is contained in:
parent
249f9c6495
commit
a01f2765e4
2 changed files with 9 additions and 17 deletions
|
@ -302,8 +302,8 @@ Zotero.Search.prototype.addCondition = function (condition, operator, value, req
|
||||||
for (let part of parts) {
|
for (let part of parts) {
|
||||||
this.addCondition('blockStart');
|
this.addCondition('blockStart');
|
||||||
|
|
||||||
// If search string is 8 characters, see if this is a item key
|
// Allow searching for exact object key
|
||||||
if (operator == 'contains' && part.text.length == 8) {
|
if (operator == 'contains' && Zotero.Utilities.isValidObjectKey(part.text)) {
|
||||||
this.addCondition('key', 'is', part.text, false);
|
this.addCondition('key', 'is', part.text, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,7 +935,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () {
|
||||||
// For conditions with an inline filter using 'is'/'isNot', combine with last condition
|
// For conditions with an inline filter using 'is'/'isNot', combine with last condition
|
||||||
// if the same
|
// if the same
|
||||||
if (lastCondition
|
if (lastCondition
|
||||||
&& name == lastCondition.name
|
&& (!lastCondition.alias || name == lastCondition.alias)
|
||||||
&& condition.operator.startsWith('is')
|
&& condition.operator.startsWith('is')
|
||||||
&& condition.operator == lastCondition.operator
|
&& condition.operator == lastCondition.operator
|
||||||
&& conditionData.inlineFilter) {
|
&& conditionData.inlineFilter) {
|
||||||
|
@ -947,7 +947,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () {
|
||||||
}
|
}
|
||||||
|
|
||||||
lastCondition = {
|
lastCondition = {
|
||||||
name,
|
name: conditionData.name,
|
||||||
alias: conditionData.name != name ? name : false,
|
alias: conditionData.name != name ? name : false,
|
||||||
table: conditionData.table,
|
table: conditionData.table,
|
||||||
field: conditionData.field,
|
field: conditionData.field,
|
||||||
|
@ -1491,11 +1491,10 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () {
|
||||||
if (val) {
|
if (val) {
|
||||||
values.push(val);
|
values.push(val);
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
Zotero.logError(`${val} is not a valid `
|
|
||||||
+ `'${condition.field}' value -- skipping`);
|
if (!values.length) {
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
condSQL += values.length > 1
|
condSQL += values.length > 1
|
||||||
|
|
|
@ -452,14 +452,7 @@ Zotero.SearchConditions = new function(){
|
||||||
special: true,
|
special: true,
|
||||||
noLoad: true,
|
noLoad: true,
|
||||||
inlineFilter: function (val) {
|
inlineFilter: function (val) {
|
||||||
try {
|
return Zotero.Utilities.isValidObjectKey(val) ? val : false;
|
||||||
val = Zotero.DataObjectUtilities.checkKey(val);
|
|
||||||
if (val) return `'${val}'`;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
Zotero.logError(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue