-->
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: Any examples on how to search across multiple entities?
PostPosted: Tue Jul 08, 2008 4:24 pm 
Regular
Regular

Joined: Fri Oct 05, 2007 3:22 am
Posts: 69
I need to understand how to create a search that spans multiple entities based on values that may or may not be entered on the ui

e.g.

input value=#{a.name}
input value=#{b.name}

return ( ( FullTextEntityManager ) em ).createFullTextQuery( luceneQuery, a.class, b.class, c.class );


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 09, 2008 4:49 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

maybe looking at one of the test classes will help:http://fisheye.jboss.org/browse/Hibernate/search/trunk/src/test/org/hibernate/search/test/query/LuceneQueryTest.java?r=12908.

Basically the idea is the following:
Code:
Query query = parser.parse( "name:foo");
FullTextQuery hibQuery = s.createFullTextQuery( query, a.class, b.class );
List result = hibQuery.list();


The result list will contains instances of class a and b. You will have to code accordingly.

--Hardy


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.