Search in sources :

Example 26 with StringPath

use of com.querydsl.core.types.dsl.StringPath in project querydsl by querydsl.

the class TermElementTest method test.

@Test
public void test() {
    StringPath title = Expressions.stringPath("title");
    LuceneSerializer serializer = new LuceneSerializer(false, true);
    QueryMetadata metadata = new DefaultQueryMetadata();
    assertEquals("title:\"Hello World\"", serializer.toQuery(title.eq("Hello World"), metadata).toString());
    assertEquals("title:Hello World", serializer.toQuery(title.eq(new TermElement("Hello World")), metadata).toString());
}
Also used : QueryMetadata(com.querydsl.core.QueryMetadata) DefaultQueryMetadata(com.querydsl.core.DefaultQueryMetadata) DefaultQueryMetadata(com.querydsl.core.DefaultQueryMetadata) TermElement(com.querydsl.lucene5.TermElement) StringPath(com.querydsl.core.types.dsl.StringPath) LuceneSerializer(com.querydsl.lucene5.LuceneSerializer) Test(org.junit.Test)

Example 27 with StringPath

use of com.querydsl.core.types.dsl.StringPath in project querydsl by querydsl.

the class LuceneSerializerNotTokenizedTest method multiple_field_search_from_movies.

@Test
public void multiple_field_search_from_movies() throws Exception {
    StringPath movie = Expressions.stringPath("movie");
    testQuery(movie.in("Interview with the Vampire"), "movie:Interview with the Vampire", 1);
    testQuery(movie.eq("Up in the Air"), "movie:Up in the Air", 1);
}
Also used : StringPath(com.querydsl.core.types.dsl.StringPath) Test(org.junit.Test)

Example 28 with StringPath

use of com.querydsl.core.types.dsl.StringPath in project querydsl by querydsl.

the class TermElementTest method test.

@Test
public void test() {
    StringPath title = Expressions.stringPath("title");
    LuceneSerializer serializer = new LuceneSerializer(false, true);
    QueryMetadata metadata = new DefaultQueryMetadata();
    assertEquals("title:\"Hello World\"", serializer.toQuery(title.eq("Hello World"), metadata).toString());
    assertEquals("title:Hello World", serializer.toQuery(title.eq(new TermElement("Hello World")), metadata).toString());
}
Also used : QueryMetadata(com.querydsl.core.QueryMetadata) DefaultQueryMetadata(com.querydsl.core.DefaultQueryMetadata) DefaultQueryMetadata(com.querydsl.core.DefaultQueryMetadata) StringPath(com.querydsl.core.types.dsl.StringPath) Test(org.junit.Test)

Example 29 with StringPath

use of com.querydsl.core.types.dsl.StringPath in project querydsl by querydsl.

the class LuceneSerializerNotTokenizedTest method multiple_field_search_from_movies.

@Test
public void multiple_field_search_from_movies() throws Exception {
    StringPath movie = Expressions.stringPath("movie");
    testQuery(movie.in("Interview with the Vampire"), "movie:Interview with the Vampire", 1);
    testQuery(movie.eq("Up in the Air"), "movie:Up in the Air", 1);
}
Also used : StringPath(com.querydsl.core.types.dsl.StringPath) Test(org.junit.Test)

Example 30 with StringPath

use of com.querydsl.core.types.dsl.StringPath in project querydsl by querydsl.

the class PhraseElementTest method test.

@Test
public void test() {
    StringPath title = Expressions.stringPath("title");
    LuceneSerializer serializer = new LuceneSerializer(false, false);
    QueryMetadata metadata = new DefaultQueryMetadata();
    assertEquals("title:Hello World", serializer.toQuery(title.eq("Hello World"), metadata).toString());
    assertEquals("title:\"Hello World\"", serializer.toQuery(title.eq(new PhraseElement("Hello World")), metadata).toString());
}
Also used : QueryMetadata(com.querydsl.core.QueryMetadata) DefaultQueryMetadata(com.querydsl.core.DefaultQueryMetadata) DefaultQueryMetadata(com.querydsl.core.DefaultQueryMetadata) StringPath(com.querydsl.core.types.dsl.StringPath) Test(org.junit.Test)

Aggregations

StringPath (com.querydsl.core.types.dsl.StringPath)36 Test (org.junit.Test)36 DefaultQueryMetadata (com.querydsl.core.DefaultQueryMetadata)6 QueryMetadata (com.querydsl.core.QueryMetadata)6 Tuple (com.querydsl.core.Tuple)4 QTuple (com.querydsl.core.types.QTuple)2 LuceneSerializer (com.querydsl.lucene5.LuceneSerializer)2 Ignore (org.junit.Ignore)2 BasicDBObject (com.mongodb.BasicDBObject)1 DBObject (com.mongodb.DBObject)1 ExcludeIn (com.querydsl.core.testutil.ExcludeIn)1 JavaTemplates (com.querydsl.core.types.JavaTemplates)1 Predicate (com.querydsl.core.types.Predicate)1 BooleanExpression (com.querydsl.core.types.dsl.BooleanExpression)1 BooleanOperation (com.querydsl.core.types.dsl.BooleanOperation)1 PathBuilder (com.querydsl.core.types.dsl.PathBuilder)1 PhraseElement (com.querydsl.lucene5.PhraseElement)1 TermElement (com.querydsl.lucene5.TermElement)1 BigDecimal (java.math.BigDecimal)1 ObjectId (org.bson.types.ObjectId)1