Skip to content

Commit

Permalink
ISPN-5729 Remote query - org/apache/lucene/uninverting/UninvertingRea…
Browse files Browse the repository at this point in the history
…der missing on "order by" query
  • Loading branch information
anistor committed Jan 12, 2017
1 parent 13d5b61 commit d6ab02e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
Expand Up @@ -68,4 +68,31 @@ public void testRemoteQuery() throws Exception {

rcm.stop();
}

@Test
public void testUninverting() throws Exception {
RemoteCacheManager rcm = createCacheManager();

SerializationContext serializationContext = ProtoStreamMarshaller.getSerializationContext(rcm);
ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder();
String protoFile = protoSchemaBuilder.fileName("test.proto")
.addClass(Person.class)
.build(serializationContext);

RemoteCache<String, String> metadataCache = rcm.getCache(ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME);
metadataCache.put("test.proto", protoFile);
assertFalse(metadataCache.containsKey(ProtobufMetadataManagerConstants.ERRORS_KEY_SUFFIX));

RemoteCache<String, Person> cache = rcm.getCache();
cache.clear();

QueryFactory qf = Search.getQueryFactory(cache);
Query query = qf.from(Person.class)
.having("name").eq("John")
.orderBy("id")
.build();
assertEquals(0, query.list().size());

rcm.stop();
}
}
Expand Up @@ -7,10 +7,18 @@ public class Person {
@ProtoField(number = 1)
public String name;

@ProtoField(number = 2)
public Integer id;

public Person(String name) {
this.name = name;
}

public Person(String name, Integer id) {
this.name = name;
this.id = id;
}

public Person() {
}
}
Expand Up @@ -8,6 +8,7 @@
<module name="javax.transaction.api" />
<module name="org.hibernate.commons-annotations" />
<module name="org.apache.lucene" export="true" />
<module name="org.apache.lucene.internal" export="true" />
<module name="org.jboss.logging" />
<module name="org.infinispan.hibernate-search.directory-provider" services="import"/>
<module name="org.hibernate.search.serialization-avro" services="import"/>
Expand Down
Expand Up @@ -110,6 +110,16 @@ public void testProjections() throws Exception {
assertEquals("Cat", list.get(0)[1]);
}

@Test
public void testUninverting() throws Exception {
remoteCache.put(1, createUser1());
remoteCache.put(2, createUser2());

QueryFactory qf = Search.getQueryFactory(remoteCache);
Query q = qf.create("from sample_bank_account.User u where u.accountIds = 777 order by u.id");
assertEquals(0, q.list().size());
}

@Test
public void testIteratorWithQuery() throws Exception {
remoteCache.put(1, createUser1());
Expand Down

0 comments on commit d6ab02e

Please sign in to comment.