You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/04/14 04:20:06 UTC
[3/3] incubator-usergrid git commit: merge
merge
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b0ca7231
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b0ca7231
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b0ca7231
Branch: refs/heads/two-dot-o-dev
Commit: b0ca7231f9d0926b5f6e7ba90474d07b21ad812a
Parents: f74139e d36ae2a
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Apr 13 20:19:59 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Apr 13 20:19:59 2015 -0600
----------------------------------------------------------------------
.../usergrid/persistence/CollectionIT.java | 4 +-
.../persistence/core/astyanax/CassandraFig.java | 3 -
.../persistence/index/impl/EsQueryVistor.java | 23 +-
.../persistence/index/impl/EntityIndexTest.java | 327 ++++++++++++++++++-
4 files changed, 339 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b0ca7231/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
index 6b95a57,746c38a..a6d7d07
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
@@@ -765,10 -765,54 +765,55 @@@ public class EntityIndexTest extends Ba
final CandidateResults r =
entityIndex.search( indexSCope, SearchTypes.fromTypes( entityId.getType() ), query, 10 );
assertEquals( user.getId(), r.get( 0 ).getId() );
+ }
- batch.deindex( indexSCope, user.getId(), user.getVersion() );
+
+ @Test
+ public void queryByStringWildCardSpaces() throws Throwable {
+
+ Id appId = new SimpleId( "application" );
+ Id ownerId = new SimpleId( "owner" );
+
+ ApplicationScope applicationScope = new ApplicationScopeImpl( appId );
+
+ IndexEdge indexSCope = new IndexEdgeImpl( ownerId, "user", SearchEdge.NodeType.SOURCE, 10 );
+
+ ApplicationEntityIndex entityIndex = eif.createApplicationEntityIndex( applicationScope );
+
+
+ Map entityMap = new HashMap() {{
+ put( "string", "I am a search string" );
+ }};
+
+ Entity user = EntityIndexMapUtils.fromMap( entityMap );
+
+ final Id entityId = new SimpleId( "entitytype" );
+
+ EntityUtils.setId( user, entityId );
+ EntityUtils.setVersion( user, UUIDGenerator.newTimeUUID() );
+
+
+ EntityIndexBatch batch = entityIndex.createBatch();
+
+ batch.index( indexSCope, user );
batch.execute().get();
- ei.refresh();
+ ei.refreshAsync().toBlocking().last();
++
+
+ final String query = "where string = 'I am*'";
+
+ final CandidateResults r =
+ entityIndex.search( indexSCope, SearchTypes.fromTypes( entityId.getType() ), query, 10 );
+
+ assertEquals( user.getId(), r.get( 0 ).getId() );
+
+ //shouldn't match
+ final String queryNoWildCard = "where string = 'I am'";
+
+ final CandidateResults noWildCardResults =
+ entityIndex.search( indexSCope, SearchTypes.fromTypes( entityId.getType() ), queryNoWildCard, 10 );
+
+ assertEquals( 0, noWildCardResults.size() );
}