fixed bug in range search

This commit is contained in:
csoler 2023-01-08 18:41:17 +01:00
parent 54cffac521
commit 737a753c2c

View File

@ -155,18 +155,19 @@ void GuiExprElement::initialiseOptionsLists()
/* W A R N I N G !!!! /* W A R N I N G !!!!
the cb elements correspond to their inverse rel op counterparts in rsexpr.h due to the nature of the cb elements correspond to their inverse rel op counterparts in rsexpr.h due to the nature of
the implementation.there the implementation.
For example consider "size greater than 100kb" selected in the GUI. For example consider "size greater than 100kb" selected in the GUI.
The rsexpr.cc impl returns true if the CONDITION specified is greater than the file size passed as argument The rsexpr.cc impl returns true if the CONDITION specified is greater than the file size passed as argument
as rsexpr iterates through the files. So, the user wants files that are greater than 100kb but the impl returns as rsexpr iterates through the files. So, the user wants files that are greater than 100kb but the impl returns
files where the condition is greater than the file size i.e. files whose size is less than or equal to the condition files where the condition is greater than the file size i.e. files whose size is less than to the condition
Therefore we invert the mapping of rel conditions here to match the behaviour of the impl. Therefore we invert the mapping of rel conditions here to match the behaviour of the impl.
Also the Equal nature of comparisons should be kept, since = is symmetric.
*/ */
GuiExprElement::relConditionIndexMap[GuiExprElement::LT_INDEX] = RsRegularExpression::GreaterEquals; GuiExprElement::relConditionIndexMap[GuiExprElement::LT_INDEX] = RsRegularExpression::Greater;
GuiExprElement::relConditionIndexMap[GuiExprElement::LTE_INDEX] = RsRegularExpression::Greater; GuiExprElement::relConditionIndexMap[GuiExprElement::LTE_INDEX] = RsRegularExpression::GreaterEquals;
GuiExprElement::relConditionIndexMap[GuiExprElement::EQUAL_INDEX] = RsRegularExpression::Equals; GuiExprElement::relConditionIndexMap[GuiExprElement::EQUAL_INDEX] = RsRegularExpression::Equals;
GuiExprElement::relConditionIndexMap[GuiExprElement::GTE_INDEX] = RsRegularExpression::Smaller; GuiExprElement::relConditionIndexMap[GuiExprElement::GTE_INDEX] = RsRegularExpression::SmallerEquals;
GuiExprElement::relConditionIndexMap[GuiExprElement::GT_INDEX] = RsRegularExpression::SmallerEquals; GuiExprElement::relConditionIndexMap[GuiExprElement::GT_INDEX] = RsRegularExpression::Smaller;
GuiExprElement::relConditionIndexMap[GuiExprElement::RANGE_INDEX] = RsRegularExpression::InRange; GuiExprElement::relConditionIndexMap[GuiExprElement::RANGE_INDEX] = RsRegularExpression::InRange;
// the string to index map // the string to index map