@JsonSerialize(include = Inclusion.NON_NULL) public Map<UUID, EntityRef> getRefsMap() { if ( refsMap != null ) { return refsMap; } getEntitiesMap(); if ( entitiesMap != null ) { refsMap = cast( entitiesMap ); return refsMap; } getRefs(); if ( refs != null ) { refsMap = new LinkedHashMap<UUID, EntityRef>(); for ( EntityRef ref : refs ) { refsMap.put( ref.getUuid(), ref ); } } return refsMap; }
getEntitiesMap(); results.getEntitiesMap();
getEntitiesMap(); results.getEntitiesMap();
public void merge( Results results ) { getEntitiesMap(); results.getEntitiesMap(); if ( entitiesMap != null || results.entitiesMap != null ) {
@Test public void stringWithSpaces() throws Exception { EntityManager em = app.getEntityManager(); assertNotNull( em ); logger.debug( "stringWithSpaces" ); Map<String, Object> props = new HashMap<String, Object>(); props.put( "myString", "My simple string" ); Entity saved = em.create( "test", props ); app.waitForQueueDrainAndRefreshIndex(); Query query = Query.fromQL( "myString = 'My simple string'" ); Results results = em.searchCollection( em.getApplicationRef(), "tests", query ); Entity entity = results.getEntitiesMap().get( saved.getUuid() ); assertNotNull( entity ); }
@Test public void subpropertyQuerying() throws Exception { EntityManager em = app.getEntityManager(); assertNotNull( em ); logger.debug( "subpropertyQuerying" ); Map<String, Object> root = new HashMap<String, Object>(); Map<String, Object> subEntity = new HashMap<String, Object>(); root.put( "rootprop1", "simpleprop" ); subEntity.put( "intprop", 10 ); subEntity.put( "substring", "I'm a tokenized string that should be indexed" ); root.put( "subentity", subEntity ); Entity saved = em.create( "test", root ); app.waitForQueueDrainAndRefreshIndex(); Query query = Query.fromQL( "rootprop1 = 'simpleprop'" ); Entity entity; Results results; results = em.searchCollection( em.getApplicationRef(), "tests", query ); entity = results.getEntitiesMap().get( saved.getUuid() ); assertNotNull( entity ); // query on the nested int value query = Query.fromQL( "subentity.intprop = 10" ); results = em.searchCollection( em.getApplicationRef(), "tests", query ); entity = results.getEntitiesMap().get( saved.getUuid() ); assertNotNull( entity ); // query on the nexted tokenized value query = Query.fromQL( "subentity.substring contains 'tokenized' and subentity.substring contains 'indexed'" ); results = em.searchCollection( em.getApplicationRef(), "tests", query ); entity = results.getEntitiesMap().get( saved.getUuid() ); assertNotNull( entity ); }
Entity entity = results.getEntitiesMap().get( saved.getUuid() ); entity = results.getEntitiesMap().get( saved.getUuid() ); entity = results.getEntitiesMap().get( saved.getUuid() ); entity = results.getEntitiesMap().get( saved.getUuid() ); results = em.searchCollection( em.getApplicationRef(), "tests", query ); entity = results.getEntitiesMap().get( saved.getUuid() );
notification = (Notification)results.getEntitiesMap().get(notification.getUuid()).toTypedEntity(); assertEquals(0, notification.getDeviceProcessedCount()); results = app.getEntityManager().searchCollection(app.getEntityManager().getApplicationRef(), "notifications", query); Entity entity = results.getEntitiesMap().get(notification.getUuid()); assertNotNull(entity);