Examples of keyword()


Examples of org.hibernate.search.query.dsl.QueryBuilder.keyword()

        List<IndexedLabel> labels = fullTextEm.createFullTextQuery( luceneQuery ).getResultList();
        assertThat( labels ).hasSize( 1 );
        assertThat( contains( labels, "test" ) ).isTrue();
      }
      {
        Query luceneQuery = b.keyword().wildcard().onField( "name" ).matching( "mas*" ).createQuery();
        List<IndexedLabel> labels = fullTextEm.createFullTextQuery( luceneQuery ).getResultList();
        assertThat( labels ).hasSize( 1 );
        assertThat( contains( labels, "massindex" ) ).isTrue();
      }
      operationSuccessful = true;
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.keyword()

      startAndWaitMassIndexing( Insurance.class );
    }
    {
      FullTextSession session = Search.getFullTextSession( openSession() );
      QueryBuilder queryBuilder = session.getSearchFactory().buildQueryBuilder().forEntity( Insurance.class ).get();
      Query luceneQuery = queryBuilder.keyword().wildcard().onField( "name" ).matching( "ins*" ).createQuery();
      Transaction transaction = session.beginTransaction();
      @SuppressWarnings("unchecked")
      List<Insurance> list = session.createFullTextQuery( luceneQuery ).list();
      assertThat( list ).hasSize( 1 );
      assertThat( list.get( 0 ).getName() ).isEqualTo( "Insurance Corporation" );
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.keyword()

    }
    {
      // Assert index creation
      FullTextSession session = Search.getFullTextSession( openSession() );
      QueryBuilder queryBuilder = session.getSearchFactory().buildQueryBuilder().forEntity( IndexedNews.class ).get();
      Query luceneQuery = queryBuilder.keyword().wildcard().onField( "newsId" ).ignoreFieldBridge().matching( "tit*" ).createQuery();
      Transaction transaction = session.beginTransaction();
      @SuppressWarnings("unchecked")
      List<IndexedNews> list = session.createFullTextQuery( luceneQuery ).list();
      assertThat( list ).hasSize( 1 );
      assertThat( list.get( 0 ).getContent() ).isEqualTo( "content" );
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.keyword()

  }

  public static Member findWithEmail(EntityManager em, String email) {
    FullTextEntityManager ftem = Search.getFullTextEntityManager( em );
    QueryBuilder b = ftem.getSearchFactory().buildQueryBuilder().forEntity( Member.class ).get();
    Query lq = b.keyword().wildcard().onField( "email" ).matching( email ).createQuery();
    Object uniqueResult = ftem.createFullTextQuery( lq ).getSingleResult();
    return (Member) uniqueResult;
  }
}
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.keyword()

            final BondPVO bond = new BondPVO(1, "Test", "DE000123");
            cache.put(bond.getId(), bond);

            final QueryBuilder qb = sm.buildQueryBuilderForClass(BondPVO.class).get();
            final Query q = qb.keyword().onField("name").matching("Test")
                  .createQuery();
            final CacheQuery cq = sm.getQuery(q, BondPVO.class);
            Assert.assertEquals(cq.getResultSize(), 1);
         }
      });
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.keyword()

            final BondPVO2 bond = new BondPVO2(1, "Test", "DE000123");
            cache.put(bond.getId(), bond);
            final QueryBuilder qb = sm.buildQueryBuilderForClass(BondPVO2.class)
                  .get();
            final Query q = qb.keyword().onField("name").matching("Test")
                  .createQuery();
            final CacheQuery cq = sm.getQuery(q, BondPVO2.class);
            Assert.assertEquals(cq.getResultSize(), 1);
         }
      });
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.keyword()

   public void testAdditionOfNewNode() {
      prepareData();

      SearchManager sm = Search.getSearchManager(cache3);
      QueryBuilder qb = sm.buildQueryBuilderForClass(VeryLongIndexNamedClass.class).get();
      Query q = qb.keyword().wildcard().onField("name").matching("value*").createQuery();
      CacheQuery cq = sm.getQuery(q, VeryLongIndexNamedClass.class);

      assertEquals(100, cq.getResultSize());

      addClusterEnabledCacheManager(getDefaultConfiguration());
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.keyword()

      addClusterEnabledCacheManager(getDefaultConfiguration());
      TestingUtil.waitForRehashToComplete(cache(0), cache(1), cache(2), cache(3));

      sm = Search.getSearchManager(cache(3));
      qb = sm.buildQueryBuilderForClass(VeryLongIndexNamedClass.class).get();
      q = qb.keyword().wildcard().onField("name").matching("value*").createQuery();
      cq = sm.getQuery(q, VeryLongIndexNamedClass.class);

      assertEquals(100, cq.getResultSize());
   }

View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.keyword()

   }

   private static void assertFindBook(Cache<Object, Object> cache) {
      SearchManager searchManager = Search.getSearchManager(cache);
      QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(Book.class).get();
      Query luceneQuery = queryBuilder.keyword().onField("title").matching("infinispan").createQuery();
      CacheQuery cacheQuery = searchManager.getQuery(luceneQuery);
      List<Object> list = cacheQuery.list();
      Assert.assertEquals(1, list.size());
   }
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.keyword()

      assertQueryReturns(cacheQuery, new Object[] { "1", foo, foo, foo.getClass(), foo.baz, foo.bar });
   }

   private CacheQuery createProjectionQuery(String... projection) {
      QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(Foo.class).get();
      Query query = queryBuilder.keyword().onField("bar").matching("bar1").createQuery();
      CacheQuery cacheQuery = searchManager.getQuery(query);
      cacheQuery.projection(projection);
      return cacheQuery;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.