GeezerVison is showing github.com — Merge branch '113-string-condition-case-updates' into dev · zhoupan/objectbox-java@b5f73aa
File treeExpand file treeCollapse file tree Open diff view settings objectbox-java/src/main/java/io/objectbox/query objectbox-kotlin/src/main/kotlin/io/objectbox/kotlin tests/objectbox-java-test/src/test/java/io/objectbox/query
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: objectbox-java/src/main/java/io/objectbox/query/PropertyQueryConditionImpl.java +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -325,7 +325,8 @@ void applyCondition(QueryBuilder<T> builder) { | 325 | 325 | builder.lessOrEqual(property, value, order); | 326 | 326 | break; | 327 | 327 | case CONTAINS: | 328 | | - builder.contains(property, value, order); | | 328 | + // Note: contains used for String[] as well, so do not enforce String type here. | | 329 | + builder.containsNoTypeCheck(property, value, order); | 329 | 330 | break; | 330 | 331 | case STARTS_WITH: | 331 | 332 | builder.startsWith(property, value, order); | |
Collapse file Copy file name to clipboardExpand all lines: objectbox-java/src/main/java/io/objectbox/query/QueryBuilder.java +12-107Lines changed: 12 additions & 107 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 38 | 38 | * | 39 | 39 | * <pre> | 40 | 40 | * userBox.query() | 41 | | - * .equal(User_.firstName, "Joe") | | 41 | + * .equal(User_.firstName, "Joe", StringOrder.CASE_SENSITIVE) | 42 | 42 | * .order(User_.lastName) | 43 | 43 | * .build() | 44 | 44 | * .find() | 45 | 45 | * </pre> | 46 | 46 | * | 47 | 47 | * <p> | 48 | | - * To add a condition use the appropriate method, for example {@link #equal(Property, String)} or | | 48 | + * To add a condition use the appropriate method, for example {@link #equal(Property, String, StringOrder)} or | 49 | 49 | * {@link #isNull(Property)}. To order results use {@link #order(Property)} and its related methods. | 50 | 50 | * <p> | 51 | 51 | * Use {@link #build()} to create a {@link Query} object, which is used to actually get the results. | @@ -70,10 +70,11 @@ public enum StringOrder { | 70 | 70 | CASE_INSENSITIVE, | 71 | 71 |
| 72 | 72 | /** | 73 | | - * Checks case of ASCII characters when macthing results, | | 73 | + * Checks case of ASCII characters when matching results, | 74 | 74 | * e.g. the condition "= example" only matches "example", but not "Example". | 75 | 75 | * <p> | 76 | | - * Use this if the property has an index. | | 76 | + * Use this if the property has an {@link io.objectbox.annotation.Index @Index} | | 77 | + * to dramatically increase the speed of looking-up results. | 77 | 78 | */ | 78 | 79 | CASE_SENSITIVE | 79 | 80 | } | @@ -449,7 +450,7 @@ public QueryBuilder<T> eager(int limit, RelationInfo relationInfo, @Nullable Rel | 449 | 450 |
| 450 | 451 | /** | 451 | 452 | * Sets a filter that executes on primary query results (returned from the db core) on a Java level. | 452 | | - * For efficiency reasons, you should always prefer primary criteria like {@link #equal(Property, String)} if | | 453 | + * For efficiency reasons, you should always prefer primary criteria like {@link #equal(Property, long)} if | 453 | 454 | * possible. | 454 | 455 | * A filter requires to instantiate full Java objects beforehand, which is less efficient. | 455 | 456 | * <p> | @@ -733,30 +734,6 @@ public QueryBuilder<T> between(Property<T> property, Date value1, Date value2) { | 733 | 734 |
| 734 | 735 | /** | 735 | 736 | * Creates an "equal ('=')" condition for this property. | 736 | | - * <p> | 737 | | - * Ignores case when matching results, e.g. {@code equal(prop, "example")} matches both "Example" and "example". | 738 | | - * <p> | 739 | | - * Use {@link #equal(Property, String, StringOrder) equal(prop, value, StringOrder.CASE_SENSITIVE)} to only match | 740 | | - * if case is equal. | 741 | | - * <p> | 742 | | - * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index} | 743 | | - * on {@code property}, dramatically speeding up look-up of results. | 744 | | - */ | 745 | | - public QueryBuilder<T> equal(Property<T> property, String value) { | 746 | | - verifyHandle(); | 747 | | - checkCombineCondition(nativeEqual(handle, property.getId(), value, false)); | 748 | | - return this; | 749 | | - } | 750 | | - | 751 | | - /** | 752 | | - * Creates an "equal ('=')" condition for this property. | 753 | | - * <p> | 754 | | - * Set {@code order} to {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to only match | 755 | | - * if case is equal. E.g. {@code equal(prop, "example", StringOrder.CASE_SENSITIVE)} only matches "example", | 756 | | - * but not "Example". | 757 | | - * <p> | 758 | | - * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index} | 759 | | - * on {@code property}, dramatically speeding up look-up of results. | 760 | 737 | */ | 761 | 738 | public QueryBuilder<T> equal(Property<T> property, String value, StringOrder order) { | 762 | 739 | verifyHandle(); | @@ -766,30 +743,6 @@ public QueryBuilder<T> equal(Property<T> property, String value, StringOrder ord | 766 | 743 |
| 767 | 744 | /** | 768 | 745 | * Creates a "not equal ('<>')" condition for this property. | 769 | | - * <p> | 770 | | - * Ignores case when matching results, e.g. {@code notEqual(prop, "example")} excludes both "Example" and "example". | 771 | | - * <p> | 772 | | - * Use {@link #notEqual(Property, String, StringOrder) notEqual(prop, value, StringOrder.CASE_SENSITIVE)} to only exclude | 773 | | - * if case is equal. | 774 | | - * <p> | 775 | | - * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index} | 776 | | - * on {@code property}, dramatically speeding up look-up of results. | 777 | | - */ | 778 | | - public QueryBuilder<T> notEqual(Property<T> property, String value) { | 779 | | - verifyHandle(); | 780 | | - checkCombineCondition(nativeNotEqual(handle, property.getId(), value, false)); | 781 | | - return this; | 782 | | - } | 783 | | - | 784 | | - /** | 785 | | - * Creates a "not equal ('<>')" condition for this property. | 786 | | - * <p> | 787 | | - * Set {@code order} to {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to only exclude | 788 | | - * if case is equal. E.g. {@code notEqual(prop, "example", StringOrder.CASE_SENSITIVE)} only excludes "example", | 789 | | - * but not "Example". | 790 | | - * <p> | 791 | | - * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index} | 792 | | - * on {@code property}, dramatically speeding up look-up of results. | 793 | 746 | */ | 794 | 747 | public QueryBuilder<T> notEqual(Property<T> property, String value, StringOrder order) { | 795 | 748 | verifyHandle(); | @@ -798,56 +751,32 @@ public QueryBuilder<T> notEqual(Property<T> property, String value, StringOrder | 798 | 751 | } | 799 | 752 |
| 800 | 753 | /** | 801 | | - * Ignores case when matching results. Use the overload and pass | 802 | | - * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored. | | 754 | + * Creates an contains condition. | 803 | 755 | * <p> | 804 | 756 | * Note: for a String array property, use {@link #containsElement} instead. | 805 | 757 | */ | 806 | | - public QueryBuilder<T> contains(Property<T> property, String value) { | | 758 | + public QueryBuilder<T> contains(Property<T> property, String value, StringOrder order) { | 807 | 759 | if (String[].class == property.type) { | 808 | 760 | throw new UnsupportedOperationException("For String[] only containsElement() is supported at this time."); | 809 | 761 | } | 810 | | - verifyHandle(); | 811 | | - checkCombineCondition(nativeContains(handle, property.getId(), value, false)); | | 762 | + containsNoTypeCheck(property, value, order); | 812 | 763 | return this; | 813 | 764 | } | 814 | 765 |
| 815 | 766 | /** | 816 | 767 | * For a String array property, matches if at least one element equals the given value. | 817 | 768 | */ | 818 | | - public QueryBuilder<T> containsElement(Property<T> property, String value) { | | 769 | + public QueryBuilder<T> containsElement(Property<T> property, String value, StringOrder order) { | 819 | 770 | if (String[].class != property.type) { | 820 | 771 | throw new IllegalArgumentException("containsElement is only supported for String[] properties."); | 821 | 772 | } | 822 | | - verifyHandle(); | 823 | | - checkCombineCondition(nativeContains(handle, property.getId(), value, false)); | | 773 | + containsNoTypeCheck(property, value, order); | 824 | 774 | return this; | 825 | 775 | } | 826 | 776 |
| 827 | | - /** | 828 | | - * Ignores case when matching results. Use the overload and pass | 829 | | - * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored. | 830 | | - */ | 831 | | - public QueryBuilder<T> startsWith(Property<T> property, String value) { | 832 | | - verifyHandle(); | 833 | | - checkCombineCondition(nativeStartsWith(handle, property.getId(), value, false)); | 834 | | - return this; | 835 | | - } | 836 | | - | 837 | | - /** | 838 | | - * Ignores case when matching results. Use the overload and pass | 839 | | - * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored. | 840 | | - */ | 841 | | - public QueryBuilder<T> endsWith(Property<T> property, String value) { | 842 | | - verifyHandle(); | 843 | | - checkCombineCondition(nativeEndsWith(handle, property.getId(), value, false)); | 844 | | - return this; | 845 | | - } | 846 | | - | 847 | | - public QueryBuilder<T> contains(Property<T> property, String value, StringOrder order) { | | 777 | + void containsNoTypeCheck(Property<T> property, String value, StringOrder order) { | 848 | 778 | verifyHandle(); | 849 | 779 | checkCombineCondition(nativeContains(handle, property.getId(), value, order == StringOrder.CASE_SENSITIVE)); | 850 | | - return this; | 851 | 780 | } | 852 | 781 |
| 853 | 782 | public QueryBuilder<T> startsWith(Property<T> property, String value, StringOrder order) { | @@ -862,14 +791,6 @@ public QueryBuilder<T> endsWith(Property<T> property, String value, StringOrder | 862 | 791 | return this; | 863 | 792 | } | 864 | 793 |
| 865 | | - /** | 866 | | - * Ignores case when matching results. Use the overload and pass | 867 | | - * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored. | 868 | | - */ | 869 | | - public QueryBuilder<T> less(Property<T> property, String value) { | 870 | | - return less(property, value, StringOrder.CASE_INSENSITIVE); | 871 | | - } | 872 | | - | 873 | 794 | public QueryBuilder<T> less(Property<T> property, String value, StringOrder order) { | 874 | 795 | verifyHandle(); | 875 | 796 | checkCombineCondition(nativeLess(handle, property.getId(), value, order == StringOrder.CASE_SENSITIVE, false)); | @@ -882,14 +803,6 @@ public QueryBuilder<T> lessOrEqual(Property<T> property, String value, StringOrd | 882 | 803 | return this; | 883 | 804 | } | 884 | 805 |
| 885 | | - /** | 886 | | - * Ignores case when matching results. Use the overload and pass | 887 | | - * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored. | 888 | | - */ | 889 | | - public QueryBuilder<T> greater(Property<T> property, String value) { | 890 | | - return greater(property, value, StringOrder.CASE_INSENSITIVE); | 891 | | - } | 892 | | - | 893 | 806 | public QueryBuilder<T> greater(Property<T> property, String value, StringOrder order) { | 894 | 807 | verifyHandle(); | 895 | 808 | checkCombineCondition(nativeGreater(handle, property.getId(), value, order == StringOrder.CASE_SENSITIVE, false)); | @@ -902,14 +815,6 @@ public QueryBuilder<T> greaterOrEqual(Property<T> property, String value, String | 902 | 815 | return this; | 903 | 816 | } | 904 | 817 |
| 905 | | - /** | 906 | | - * Ignores case when matching results. Use the overload and pass | 907 | | - * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored. | 908 | | - */ | 909 | | - public QueryBuilder<T> in(Property<T> property, String[] values) { | 910 | | - return in(property, values, StringOrder.CASE_INSENSITIVE); | 911 | | - } | 912 | | - | 913 | 818 | public QueryBuilder<T> in(Property<T> property, String[] values, StringOrder order) { | 914 | 819 | verifyHandle(); | 915 | 820 | checkCombineCondition(nativeIn(handle, property.getId(), values, order == StringOrder.CASE_SENSITIVE)); | |
Collapse file Copy file name to clipboardExpand all lines: objectbox-kotlin/src/main/kotlin/io/objectbox/kotlin/QueryBuilder.kt -4Lines changed: 0 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,10 +28,6 @@ inline fun <reified T> QueryBuilder<T>.inValues(property: Property<T>, values: L | 28 | 28 | inline fun <reified T> QueryBuilder<T>.inValues(property: Property<T>, values: IntArray): QueryBuilder<T> = | 29 | 29 | `in`(property, values) | 30 | 30 |
| 31 | | -/** An alias for the "in" method, which is a reserved keyword in Kotlin. */ | 32 | | -inline fun <reified T> QueryBuilder<T>.inValues(property: Property<T>, values: Array<String>): QueryBuilder<T> = | 33 | | - `in`(property, values) | 34 | | - | 35 | 31 | /** An alias for the "in" method, which is a reserved keyword in Kotlin. */ | 36 | 32 | inline fun <reified T> QueryBuilder<T>.inValues( | 37 | 33 | property: Property<T>, values: Array<String>, | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/test/java/io/objectbox/query/PropertyQueryTest.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -82,7 +82,7 @@ public void testFindStrings() { | 82 | 82 | putTestEntity("BAR", 100); | 83 | 83 | putTestEntitiesStrings(); | 84 | 84 | putTestEntity("banana", 101); | 85 | | - Query<TestEntity> query = box.query().startsWith(simpleString, "b").build(); | | 85 | + Query<TestEntity> query = box.query().startsWith(simpleString, "b", StringOrder.CASE_INSENSITIVE).build(); | 86 | 86 |
| 87 | 87 | String[] result = query.property(simpleString).findStrings(); | 88 | 88 | assertEquals(5, result.length); | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/test/java/io/objectbox/query/QueryTest.java +17-17Lines changed: 17 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -78,8 +78,8 @@ public void testBuildTwice() { | 78 | 78 | queryBuilder.between(TestEntity_.simpleInt, 42, 43); | 79 | 79 | queryBuilder.in(TestEntity_.simpleInt, new int[]{42}); | 80 | 80 | queryBuilder.notIn(TestEntity_.simpleInt, new int[]{42}); | 81 | | - queryBuilder.contains(TestEntity_.simpleString, "42"); | 82 | | - queryBuilder.startsWith(TestEntity_.simpleString, "42"); | | 81 | + queryBuilder.contains(TestEntity_.simpleString, "42", StringOrder.CASE_INSENSITIVE); | | 82 | + queryBuilder.startsWith(TestEntity_.simpleString, "42", StringOrder.CASE_SENSITIVE); | 83 | 83 | queryBuilder.order(TestEntity_.simpleInt); | 84 | 84 | queryBuilder.build().find(); | 85 | 85 | } | @@ -272,11 +272,11 @@ public void testOffsetLimit() { | 272 | 272 | public void testString() { | 273 | 273 | List<TestEntity> entities = putTestEntitiesStrings(); | 274 | 274 | int count = entities.size(); | 275 | | - assertEquals(1, getUniqueNotNull(box.query().equal(simpleString, "banana").build()).getId()); | 276 | | - assertEquals(count - 1, box.query().notEqual(simpleString, "banana").build().count()); | 277 | | - assertEquals(4, getUniqueNotNull(box.query().startsWith(simpleString, "ba").endsWith(simpleString, "shake").build()) | | 275 | + assertEquals(1, getUniqueNotNull(box.query().equal(simpleString, "banana", StringOrder.CASE_INSENSITIVE).build()).getId()); | | 276 | + assertEquals(count - 1, box.query().notEqual(simpleString, "banana", StringOrder.CASE_INSENSITIVE).build().count()); | | 277 | + assertEquals(4, getUniqueNotNull(box.query().startsWith(simpleString, "ba", StringOrder.CASE_INSENSITIVE).endsWith(simpleString, "shake", StringOrder.CASE_INSENSITIVE).build()) | 278 | 278 | .getId()); | 279 | | - assertEquals(2, box.query().contains(simpleString, "nana").build().count()); | | 279 | + assertEquals(2, box.query().contains(simpleString, "nana", StringOrder.CASE_INSENSITIVE).build().count()); | 280 | 280 | } | 281 | 281 |
| 282 | 282 | @Test | @@ -285,12 +285,12 @@ public void testStringArray() { | 285 | 285 |
| 286 | 286 | // Using contains should not work on String array. | 287 | 287 | Exception exception = assertThrows(UnsupportedOperationException.class, | 288 | | - () -> box.query().contains(simpleStringArray, "banana")); | | 288 | + () -> box.query().contains(simpleStringArray, "banana", StringOrder.CASE_INSENSITIVE)); | 289 | 289 | assertEquals("For String[] only containsElement() is supported at this time.", exception.getMessage()); | 290 | 290 |
| 291 | 291 | // containsElement(prop, value) matches if value is equal to one of the array items. | 292 | 292 | // Verify by not matching entity where 'banana' is only a substring of an array item ('banana milk shake'). | 293 | | - List<TestEntity> results = box.query().containsElement(simpleStringArray, "banana").build().find(); | | 293 | + List<TestEntity> results = box.query().containsElement(simpleStringArray, "banana", StringOrder.CASE_INSENSITIVE).build().find(); | 294 | 294 | assertEquals(1, results.size()); | 295 | 295 | assertEquals("banana", results.get(0).getSimpleStringArray()[0]); | 296 | 296 | } | @@ -299,7 +299,7 @@ public void testStringArray() { | 299 | 299 | public void testStringLess() { | 300 | 300 | putTestEntitiesStrings(); | 301 | 301 | putTestEntity("BaNaNa Split", 100); | 302 | | - Query<TestEntity> query = box.query().less(simpleString, "banana juice").order(simpleString).build(); | | 302 | + Query<TestEntity> query = box.query().less(simpleString, "banana juice", StringOrder.CASE_INSENSITIVE).order(simpleString).build(); | 303 | 303 | List<TestEntity> entities = query.find(); | 304 | 304 | assertEquals(2, entities.size()); | 305 | 305 | assertEquals("apple", entities.get(0).getSimpleString()); | @@ -355,7 +355,7 @@ public void string_lessOrEqual_works() { | 355 | 355 | public void testStringGreater() { | 356 | 356 | putTestEntitiesStrings(); | 357 | 357 | putTestEntity("FOO", 100); | 358 | | - Query<TestEntity> query = box.query().greater(simpleString, "banana juice").order(simpleString).build(); | | 358 | + Query<TestEntity> query = box.query().greater(simpleString, "banana juice", StringOrder.CASE_INSENSITIVE).order(simpleString).build(); | 359 | 359 | List<TestEntity> entities = query.find(); | 360 | 360 | assertEquals(4, entities.size()); | 361 | 361 | assertEquals("banana milk shake", entities.get(0).getSimpleString()); | @@ -410,7 +410,7 @@ public void testStringIn() { | 410 | 410 | putTestEntitiesStrings(); | 411 | 411 | putTestEntity("BAR", 100); | 412 | 412 | String[] values = {"bar", "foo bar"}; | 413 | | - Query<TestEntity> query = box.query().in(simpleString, values).order(simpleString, OrderFlags.CASE_SENSITIVE) | | 413 | + Query<TestEntity> query = box.query().in(simpleString, values, StringOrder.CASE_INSENSITIVE).order(simpleString, OrderFlags.CASE_SENSITIVE) | 414 | 414 | .build(); | 415 | 415 | List<TestEntity> entities = query.find(); | 416 | 416 | assertEquals(3, entities.size()); | @@ -609,15 +609,15 @@ public void testBigResultList() { | 609 | 609 | } | 610 | 610 | box.put(entities); | 611 | 611 | int count = entities.size(); | 612 | | - List<TestEntity> entitiesQueried = box.query().equal(simpleString, sameValueForAll).build().find(); | | 612 | + List<TestEntity> entitiesQueried = box.query().equal(simpleString, sameValueForAll, StringOrder.CASE_INSENSITIVE).build().find(); | 613 | 613 | assertEquals(count, entitiesQueried.size()); | 614 | 614 | } | 615 | 615 |
| 616 | 616 | @Test | 617 | 617 | public void testEqualStringOrder() { | 618 | 618 | putTestEntitiesStrings(); | 619 | 619 | putTestEntity("BAR", 100); | 620 | | - assertEquals(2, box.query().equal(simpleString, "bar").build().count()); | | 620 | + assertEquals(2, box.query().equal(simpleString, "bar", StringOrder.CASE_INSENSITIVE).build().count()); | 621 | 621 | assertEquals(1, box.query().equal(simpleString, "bar", StringOrder.CASE_SENSITIVE).build().count()); | 622 | 622 | } | 623 | 623 |
| @@ -800,7 +800,7 @@ public void testSetParameter2Floats() { | 800 | 800 | @Test | 801 | 801 | public void testSetParameterString() { | 802 | 802 | putTestEntitiesStrings(); | 803 | | - Query<TestEntity> query = box.query().equal(simpleString, "banana").parameterAlias("foo").build(); | | 803 | + Query<TestEntity> query = box.query().equal(simpleString, "banana", StringOrder.CASE_INSENSITIVE).parameterAlias("foo").build(); | 804 | 804 | assertEquals(1, getUniqueNotNull(query).getId()); | 805 | 805 | query.setParameter(simpleString, "bar"); | 806 | 806 | assertEquals(3, getUniqueNotNull(query).getId()); | @@ -836,7 +836,7 @@ public void parameterAlias_combinedConditions() { | 836 | 836 | public void testForEach() { | 837 | 837 | List<TestEntity> testEntities = putTestEntitiesStrings(); | 838 | 838 | final StringBuilder stringBuilder = new StringBuilder(); | 839 | | - box.query().startsWith(simpleString, "banana").build() | | 839 | + box.query().startsWith(simpleString, "banana", StringOrder.CASE_INSENSITIVE).build() | 840 | 840 | .forEach(data -> stringBuilder.append(data.getSimpleString()).append('#')); | 841 | 841 | assertEquals("banana#banana milk shake#", stringBuilder.toString()); | 842 | 842 |
| @@ -849,7 +849,7 @@ public void testForEach() { | 849 | 849 | public void testForEachBreak() { | 850 | 850 | putTestEntitiesStrings(); | 851 | 851 | final StringBuilder stringBuilder = new StringBuilder(); | 852 | | - box.query().startsWith(simpleString, "banana").build() | | 852 | + box.query().startsWith(simpleString, "banana", StringOrder.CASE_INSENSITIVE).build() | 853 | 853 | .forEach(data -> { | 854 | 854 | stringBuilder.append(data.getSimpleString()); | 855 | 855 | throw new BreakForEach(); | @@ -947,7 +947,7 @@ public void testDescribe() { | 947 | 947 |
| 948 | 948 | // Some conditions. | 949 | 949 | Query<TestEntity> query = box.query() | 950 | | - .equal(TestEntity_.simpleString, "Hello") | | 950 | + .equal(TestEntity_.simpleString, "Hello", StringOrder.CASE_INSENSITIVE) | 951 | 951 | .or().greater(TestEntity_.simpleInt, 42) | 952 | 952 | .build(); | 953 | 953 | String describeActual = query.describe(); | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/test/java/io/objectbox/query/QueryTest2.java +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 16 | 16 |
| 17 | 17 | package io.objectbox.query; | 18 | 18 |
| | 19 | +import io.objectbox.query.QueryBuilder.StringOrder; | 19 | 20 | import org.junit.Test; | 20 | 21 |
| 21 | 22 | import java.util.List; | @@ -41,7 +42,7 @@ public void newQueryApi() { | 41 | 42 |
| 42 | 43 | // current query API | 43 | 44 | Query<TestEntity> query = box.query() | 44 | | - .equal(TestEntity_.simpleString, "Fry") | | 45 | + .equal(TestEntity_.simpleString, "Fry", StringOrder.CASE_INSENSITIVE) | 45 | 46 | .less(TestEntity_.simpleInt, 12) | 46 | 47 | .or() | 47 | 48 | .in(TestEntity_.simpleLong, new long[]{1012}) | |
|