-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate search 5.5.3Final indexing but data not fetched?
PostPosted: Tue Jun 07, 2016 5:11 pm 
Newbie

Joined: Fri May 20, 2016 3:00 am
Posts: 5
I have set up hibernate with the following maven dependency

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.1.0.Final</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.5.3.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.7.2.RELEASE</version>
</dependency>


<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.driver.version}</version>
</dependency>

I have configure Hibernate with indexing using this piece of code

jpaProperties.put("hibernate.search.default.directory_provide","filesystem" );
jpaProperties.put("hibernate.search.default.indexBase","C:\\Index" );

This is the code I am running

public List<Deals> findDealBySubcatIdhsearch(long subCatId,String search){
//Option or suboption may be included in future, if needed
logger.info("Deal nameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"+search+"iiiiiiiiiiid"+subCatId);

FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.
getFullTextEntityManager(em);
QueryBuilder qb = fullTextEntityManager.getSearchFactory()
.buildQueryBuilder().forEntity(Deals.class).get();
org.apache.lucene.search.Query query = qb
.keyword().wildcard().onFields("dealName").matching("*"+search.toLowerCase()+"*")
.createQuery();

org.hibernate.search.jpa.FullTextQuery jpaQueryy =
fullTextEntityManager.createFullTextQuery(query, Deals.class);

//jpaQueryy.enableFullTextFilter("category").setParameter("categoryId", 1);
List<Deals> results = jpaQueryy.getResultList();


logger.info("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"+jpaQueryy.getResultSize()+"Subid"+subCatId);
if(jpaQueryy.getResultList().size()==0)
{
query = qb
.keyword().onFields("dealName").matching("*"+search.toLowerCase()+"*")
.createQuery();

jpaQueryy =
fullTextEntityManager.createFullTextQuery(query, Deals.class);

results = jpaQueryy.getResultList();
}
List<Deals> output =
results.parallelStream()
.filter(d -> d.getSubcategories().getSubcategoryId() == subCatId)
.collect(Collectors.toList());

return output;
}
But when i persist a object Hibernate search data is indexed but hibernate search does not fetch the details of the persisted object.There is no error in the console.What is the error?


Top
 Profile  
 
 Post subject: Re: Hibernate search 5.5.3Final indexing but data not fetched?
PostPosted: Wed Jun 08, 2016 8:10 am 
Newbie

Joined: Fri May 20, 2016 3:00 am
Posts: 5
I finally found the error the error was that the parameter dealname which i was using for hibernate search had null values because of that it did not fetch the result.`


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.