You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/12/15 14:09:39 UTC

[09/50] [abbrv] ignite git commit: IGNITE-7055: Fix text query to work with a particular field. - Fixes #3151.

IGNITE-7055: Fix text query to work with a particular field. - Fixes #3151.

Signed-off-by: shroman <rs...@yahoo.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/27095c87
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/27095c87
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/27095c87

Branch: refs/heads/ignite-zk-ce
Commit: 27095c87d6ea69682859df4a95bf81657fb64626
Parents: 8ba773b
Author: shroman <rs...@yahoo.com>
Authored: Tue Dec 12 09:34:56 2017 +0900
Committer: shroman <rs...@yahoo.com>
Committed: Tue Dec 12 09:34:56 2017 +0900

----------------------------------------------------------------------
 .../processors/query/h2/IgniteH2Indexing.java   |  2 +-
 .../cache/GridCacheFullTextQuerySelfTest.java   | 30 ++++++++++++++------
 2 files changed, 22 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/27095c87/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index f3a95a5..83eaa33 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -814,7 +814,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
             try {
                 runs.put(run.id(), run);
 
-                return tbl.luceneIndex().query(qry, filters);
+                return tbl.luceneIndex().query(qry.toUpperCase(), filters);
             }
             finally {
                 runs.remove(run.id());

http://git-wip-us.apache.org/repos/asf/ignite/blob/27095c87/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQuerySelfTest.java
index 747038d..a4d8955 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQuerySelfTest.java
@@ -41,6 +41,7 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -104,8 +105,13 @@ public class GridCacheFullTextQuerySelfTest extends GridCommonAbstractTest {
     }
 
     /**
-     * JUnit.
-     *
+     * @throws Exception In case of error.
+     */
+    public void testTextQueryWithField() throws Exception {
+        checkTextQuery("name:1*", false, false);
+    }
+
+    /**
      * @throws Exception In case of error.
      */
     public void testLocalTextQueryWithKeepBinary() throws Exception {
@@ -113,8 +119,6 @@ public class GridCacheFullTextQuerySelfTest extends GridCommonAbstractTest {
     }
 
     /**
-     * JUnit.
-     *
      * @throws Exception In case of error.
      */
     public void testLocalTextQuery() throws Exception {
@@ -122,8 +126,6 @@ public class GridCacheFullTextQuerySelfTest extends GridCommonAbstractTest {
     }
 
     /**
-     * JUnit.
-     *
      * @throws Exception In case of error.
      */
     public void testTextQueryWithKeepBinary() throws Exception {
@@ -131,8 +133,6 @@ public class GridCacheFullTextQuerySelfTest extends GridCommonAbstractTest {
     }
 
     /**
-     * JUnit.
-     *
      * @throws Exception In case of error.
      */
     public void testTextQuery() throws Exception {
@@ -144,8 +144,20 @@ public class GridCacheFullTextQuerySelfTest extends GridCommonAbstractTest {
      * @param keepBinary keep binary flag.
      */
     private void checkTextQuery(boolean loc, boolean keepBinary) throws Exception {
+        checkTextQuery(null, loc, keepBinary);
+    }
+
+    /**
+     * @param clause Query clause.
+     * @param loc local query flag.
+     * @param keepBinary keep binary flag.
+     */
+    private void checkTextQuery(String clause, boolean loc, boolean keepBinary) throws Exception {
         final IgniteEx ignite = grid(0);
 
+        if (F.isEmpty(clause))
+            clause = "1*";
+
         // 1. Populate cache with data, calculating expected count in parallel.
         Set<Integer> exp = populateCache(ignite, loc, MAX_ITEM_COUNT, new IgnitePredicate<Integer>() {
             @Override
@@ -155,7 +167,7 @@ public class GridCacheFullTextQuerySelfTest extends GridCommonAbstractTest {
         });
 
         // 2. Validate results.
-        TextQuery qry = new TextQuery<>(Person.class, "1*").setLocal(loc);
+        TextQuery qry = new TextQuery<>(Person.class, clause).setLocal(loc);
 
         validateQueryResults(ignite, qry, exp, keepBinary);