use of org.infinispan.query.dsl.embedded.testdomain.hsearch.TransactionHS in project infinispan by infinispan.
the class EmbeddedRemoteInteropQueryTest method testDuplicateBooleanProjectionRemote.
public void testDuplicateBooleanProjectionRemote() {
Transaction transaction = new TransactionHS();
transaction.setId(3);
transaction.setDescription("Hotel");
transaction.setAccountId(2);
transaction.setAmount(45);
transaction.setDate(new Date(42));
transaction.setDebit(true);
transaction.setValid(true);
cache.put(transaction.getId(), transaction);
QueryFactory qf = Search.getQueryFactory(remoteCache);
Query<Object[]> q = qf.create("SELECT id, isDebit, isDebit FROM sample_bank_account.Transaction WHERE description = 'Hotel'");
List<Object[]> list = q.execute().list();
assertEquals(1, list.size());
assertEquals(3, list.get(0).length);
assertEquals(3, list.get(0)[0]);
assertEquals(true, list.get(0)[1]);
assertEquals(true, list.get(0)[2]);
}
use of org.infinispan.query.dsl.embedded.testdomain.hsearch.TransactionHS in project infinispan by infinispan.
the class EmbeddedRemoteInteropQueryTest method testRemoteFullTextQuery.
public void testRemoteFullTextQuery() {
Transaction transaction = new TransactionHS();
transaction.setId(3);
transaction.setDescription("Hotel");
transaction.setLongDescription("Expenses for Infinispan F2F meeting");
transaction.setAccountId(2);
transaction.setAmount(99);
transaction.setDate(new Date(42));
transaction.setDebit(true);
transaction.setValid(true);
cache.put(transaction.getId(), transaction);
QueryFactory qf = Search.getQueryFactory(remoteCache);
// Hibernate Search 6 does not support fields that are sortable and full text at the same time
Query<Transaction> q = qf.create("from sample_bank_account.Transaction where longDescription='Expenses for Infinispan F2F meeting'");
List<Transaction> list = q.execute().list();
assertEquals(1, list.size());
}
use of org.infinispan.query.dsl.embedded.testdomain.hsearch.TransactionHS in project infinispan by infinispan.
the class EmbeddedRemoteInteropQueryTest method testDuplicateBooleanProjectionEmbedded.
public void testDuplicateBooleanProjectionEmbedded() {
Transaction transaction = new TransactionHS();
transaction.setId(3);
transaction.setDescription("Hotel");
transaction.setAccountId(2);
transaction.setAmount(45);
transaction.setDate(new Date(42));
transaction.setDebit(true);
transaction.setValid(true);
cache.put(transaction.getId(), transaction);
QueryFactory qf = org.infinispan.query.Search.getQueryFactory(cache);
Query<Object[]> q = qf.create("SELECT id, isDebit, isDebit FROM " + TransactionHS.class.getName() + " WHERE description = 'Hotel'");
List<Object[]> list = q.execute().list();
assertEquals(1, list.size());
assertEquals(3, list.get(0).length);
assertEquals(3, list.get(0)[0]);
assertEquals(true, list.get(0)[1]);
assertEquals(true, list.get(0)[2]);
}
use of org.infinispan.query.dsl.embedded.testdomain.hsearch.TransactionHS in project infinispan by infinispan.
the class EmbeddedTransactionMarshaller method readFrom.
@Override
public TransactionHS readFrom(ProtoStreamReader reader) throws IOException {
int id = reader.readInt("id");
String description = reader.readString("description");
int accountId = reader.readInt("accountId");
long date = reader.readLong("date");
double amount = reader.readDouble("amount");
boolean isDebit = reader.readBoolean("isDebit");
boolean isValid = reader.readBoolean("isValid");
TransactionHS transaction = new TransactionHS();
transaction.setId(id);
transaction.setDescription(description);
transaction.setAccountId(accountId);
transaction.setDate(new Date(date));
transaction.setAmount(amount);
transaction.setDebit(isDebit);
transaction.setValid(isValid);
return transaction;
}
use of org.infinispan.query.dsl.embedded.testdomain.hsearch.TransactionHS in project infinispan by infinispan.
the class NonIndexedEmbeddedRemoteQueryTest method testRemoteFullTextQuery.
@Test(expectedExceptions = HotRodClientException.class, expectedExceptionsMessageRegExp = "org.infinispan.objectfilter.ParsingException: ISPN028521: Full-text queries cannot be applied to property 'longDescription' in type sample_bank_account.Transaction unless the property is indexed and analyzed.")
@Override
public void testRemoteFullTextQuery() {
Transaction transaction = new TransactionHS();
transaction.setId(3);
transaction.setDescription("Hotel");
transaction.setLongDescription("Expenses for Infinispan F2F meeting");
transaction.setAccountId(2);
transaction.setAmount(99);
transaction.setDate(new Date(42));
transaction.setDebit(true);
transaction.setValid(true);
cache.put(transaction.getId(), transaction);
QueryFactory qf = Search.getQueryFactory(remoteCache);
Query<Transaction> q = qf.create("from sample_bank_account.Transaction where longDescription:'Expenses for Infinispan F2F meeting'");
List<Transaction> list = q.execute().list();
assertEquals(1, list.size());
}
Aggregations