mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
make string searches in oracle text case insensitive
This commit is contained in:
@@ -290,15 +290,14 @@ public final class CardRulesPredicates {
|
||||
boolean shouldContain;
|
||||
switch (this.field) {
|
||||
case NAME:
|
||||
return this.op(card.getName(), this.operand);
|
||||
return op(card.getName(), this.operand);
|
||||
case SUBTYPE:
|
||||
shouldContain = (this.getOperator() == StringOp.CONTAINS) || (this.getOperator() == StringOp.EQUALS);
|
||||
return shouldContain == card.getType().subTypeContains(this.operand);
|
||||
case ORACLE_TEXT:
|
||||
shouldContain = (this.getOperator() == StringOp.CONTAINS) || (this.getOperator() == StringOp.EQUALS);
|
||||
return shouldContain == card.getOracleText().contains(this.operand);
|
||||
return op(card.getOracleText(), operand);
|
||||
case JOINED_TYPE:
|
||||
return this.op(card.getType().toString(), this.operand);
|
||||
return op(card.getType().toString(), operand);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -88,10 +88,7 @@ public class SFilterUtil {
|
||||
return Predicates.alwaysTrue();
|
||||
}
|
||||
|
||||
String[] splitText = text
|
||||
.replaceAll(",", "")
|
||||
.replaceAll(" ", " ")
|
||||
.toLowerCase().split(" ");
|
||||
String[] splitText = text.replaceAll(",", "").replaceAll(" ", " ").split(" ");
|
||||
|
||||
List<Predicate<CardRules>> terms = new ArrayList<Predicate<CardRules>>();
|
||||
for (String s : splitText) {
|
||||
@@ -99,9 +96,7 @@ public class SFilterUtil {
|
||||
|
||||
if (inName) { subands.add(CardRulesPredicates.name(StringOp.CONTAINS_IC, s)); }
|
||||
if (inType) { subands.add(CardRulesPredicates.joinedType(StringOp.CONTAINS_IC, s)); }
|
||||
|
||||
// rules cannot compare in ignore-case way
|
||||
if (inText) { subands.add(CardRulesPredicates.rules(StringOp.CONTAINS, s)); }
|
||||
if (inText) { subands.add(CardRulesPredicates.rules(StringOp.CONTAINS_IC, s)); }
|
||||
|
||||
terms.add(Predicates.or(subands));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user