Search in sources :

Example 6 with Discovery4Search

use of siena.base.test.model.Discovery4Search in project siena by mandubian.

the class DrizzleTest method testSearchMultipleWordsSingleField.

public void testSearchMultipleWordsSingleField() {
    Discovery4Search AB = new Discovery4Search("alpha beta", LongAutoID_CURIE);
    Discovery4Search GB = new Discovery4Search("gamma beta", LongAutoID_CURIE);
    Discovery4Search GD = new Discovery4Search("gamma delta", LongAutoID_CURIE);
    Discovery4Search ET = new Discovery4Search("epsilon theta", LongAutoID_CURIE);
    pm.insert(AB);
    pm.insert(GB);
    pm.insert(GD);
    pm.insert(ET);
    Query<Discovery4Search> query = pm.createQuery(Discovery4Search.class).search("alpha delta", "name").order("name");
    List<Discovery4Search> res = query.fetch();
    assertEquals(2, res.size());
    assertEquals(AB, res.get(0));
    assertEquals(GD, res.get(1));
}
Also used : Discovery4Search(siena.base.test.model.Discovery4Search)

Example 7 with Discovery4Search

use of siena.base.test.model.Discovery4Search in project siena by mandubian.

the class GaeAsyncTest method testSearchSingleFieldBeginSeveralResultsKeysOnly.

public void testSearchSingleFieldBeginSeveralResultsKeysOnly() {
    Discovery4Search[] discs = new Discovery4Search[5];
    discs[0] = new Discovery4Search("alpha", LongAutoID_CURIE);
    discs[1] = new Discovery4Search("beta", LongAutoID_CURIE);
    discs[2] = new Discovery4Search("alphagamma", LongAutoID_CURIE);
    discs[3] = new Discovery4Search("delta", LongAutoID_CURIE);
    discs[4] = new Discovery4Search("eta", LongAutoID_CURIE);
    pm.insert((Object[]) discs).get();
    QueryAsync<Discovery4Search> query = pm.createQuery(Discovery4Search.class).search("alpha*", "name");
    SienaFuture<List<Discovery4Search>> future = query.fetchKeys();
    List<Discovery4Search> res = future.get();
    assertEquals(2, res.size());
    assertEquals(discs[0].id, res.get(0).id);
    assertTrue(res.get(0).isOnlyIdFilled());
    assertEquals(discs[2].id, res.get(1).id);
    assertTrue(res.get(1).isOnlyIdFilled());
}
Also used : List(java.util.List) Discovery4Search(siena.base.test.model.Discovery4Search)

Example 8 with Discovery4Search

use of siena.base.test.model.Discovery4Search in project siena by mandubian.

the class GaeAsyncTest method testSearchSingleFieldEndException.

public void testSearchSingleFieldEndException() {
    Discovery4Search[] discs = new Discovery4Search[5];
    discs[0] = new Discovery4Search("alpha", LongAutoID_CURIE);
    discs[1] = new Discovery4Search("beta", LongAutoID_CURIE);
    discs[2] = new Discovery4Search("alphagamma", LongAutoID_CURIE);
    discs[3] = new Discovery4Search("delta", LongAutoID_CURIE);
    discs[4] = new Discovery4Search("eta", LongAutoID_CURIE);
    pm.insert((Object[]) discs).get();
    try {
        QueryAsync<Discovery4Search> query = pm.createQuery(Discovery4Search.class).search("*gamma", "name");
        query.fetch();
    } catch (SienaException ex) {
        return;
    }
    fail();
}
Also used : SienaException(siena.SienaException) Discovery4Search(siena.base.test.model.Discovery4Search)

Example 9 with Discovery4Search

use of siena.base.test.model.Discovery4Search in project siena by mandubian.

the class GaeAsyncTest method testSearchSingleFieldBeginSingleResults.

public void testSearchSingleFieldBeginSingleResults() {
    Discovery4Search[] discs = new Discovery4Search[5];
    discs[0] = new Discovery4Search("alpha", LongAutoID_CURIE);
    discs[1] = new Discovery4Search("beta", LongAutoID_CURIE);
    discs[2] = new Discovery4Search("gamma", LongAutoID_CURIE);
    discs[3] = new Discovery4Search("delta", LongAutoID_CURIE);
    discs[4] = new Discovery4Search("eta", LongAutoID_CURIE);
    pm.insert((Object[]) discs).get();
    QueryAsync<Discovery4Search> query = pm.createQuery(Discovery4Search.class).search("gamma*", "name");
    SienaFuture<List<Discovery4Search>> future = query.fetch();
    List<Discovery4Search> res = future.get();
    assertEquals(1, res.size());
    assertEquals(discs[2], res.get(0));
}
Also used : List(java.util.List) Discovery4Search(siena.base.test.model.Discovery4Search)

Example 10 with Discovery4Search

use of siena.base.test.model.Discovery4Search in project siena by mandubian.

the class JdbcTest method testSearchMultipleWordsSingleField.

public void testSearchMultipleWordsSingleField() {
    Discovery4Search AB = new Discovery4Search("alpha beta", LongAutoID_CURIE);
    Discovery4Search GB = new Discovery4Search("gamma beta", LongAutoID_CURIE);
    Discovery4Search GD = new Discovery4Search("gamma delta", LongAutoID_CURIE);
    Discovery4Search ET = new Discovery4Search("epsilon theta", LongAutoID_CURIE);
    pm.insert(AB);
    pm.insert(GB);
    pm.insert(GD);
    pm.insert(ET);
    Query<Discovery4Search> query = pm.createQuery(Discovery4Search.class).search("alpha delta", "name").order("name");
    List<Discovery4Search> res = query.fetch();
    assertEquals(2, res.size());
    assertEquals(AB, res.get(0));
    assertEquals(GD, res.get(1));
}
Also used : Discovery4Search(siena.base.test.model.Discovery4Search)

Aggregations

Discovery4Search (siena.base.test.model.Discovery4Search)25 List (java.util.List)7 ArrayList (java.util.ArrayList)3 SienaException (siena.SienaException)2 SienaRestrictedApiException (siena.SienaRestrictedApiException)2