Search in sources :

Example 21 with QueryModifiers

use of com.querydsl.core.QueryModifiers in project querydsl by querydsl.

the class LuceneQueryTest method list_sorted_ascending_by_year_restrict_limit_2_offset_1.

@Test
public void list_sorted_ascending_by_year_restrict_limit_2_offset_1() {
    query.where(year.between(1800, 2000));
    query.restrict(new QueryModifiers(2L, 1L));
    query.orderBy(year.asc());
    final List<Document> documents = query.fetch();
    assertFalse(documents.isEmpty());
    assertEquals(2, documents.size());
    assertEquals("1954", documents.get(0).get("year"));
    assertEquals("1990", documents.get(1).get("year"));
}
Also used : QueryModifiers(com.querydsl.core.QueryModifiers) Test(org.junit.Test)

Example 22 with QueryModifiers

use of com.querydsl.core.QueryModifiers in project querydsl by querydsl.

the class LuceneQueryTest method list_sorted_ascending_by_year_restrict_limit_2_offset_1.

@Test
public void list_sorted_ascending_by_year_restrict_limit_2_offset_1() {
    query.where(year.between(1800, 2000));
    query.restrict(new QueryModifiers(2L, 1L));
    query.orderBy(year.asc());
    final List<Document> documents = query.fetch();
    assertFalse(documents.isEmpty());
    assertEquals(2, documents.size());
    assertEquals("1954", documents.get(0).get("year"));
    assertEquals("1990", documents.get(1).get("year"));
}
Also used : QueryModifiers(com.querydsl.core.QueryModifiers) Document(org.apache.lucene.document.Document) Test(org.junit.Test)

Aggregations

QueryModifiers (com.querydsl.core.QueryModifiers)22 Test (org.junit.Test)11 QueryFlag (com.querydsl.core.QueryFlag)7 Document (org.apache.lucene.document.Document)6 QueryMixin (com.querydsl.core.support.QueryMixin)1 QEmployee (com.querydsl.sql.domain.QEmployee)1