-->
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: Problem with inheritance
PostPosted: Thu Dec 16, 2010 11:57 am 
Newbie

Joined: Mon May 31, 2010 10:46 am
Posts: 4
Assume, we have three classes
Code:
@Indexed
class A {
  @Field...
  private String name;
}

@Indexed
class B extends A {
  @Field...
  private String notes;
}

@Indexed
class C extends A {
  @Field...
  private String abbrev;
}

How do I have to build my query parser in order to do a search within all fields of this class hierarchy?

When I create a query based on the following code, I get an error, that notes is not in the index of A.class:
Code:
QueryBuilder qb = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(A.class).get();
String[] fields = new String[]{"name", "notes", "abbrev"};
org.apache.lucene.search.Query query = qb.keyword().onFields(fields).matching(q).createQuery();
org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(query);

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: Problem with inheritance
PostPosted: Fri Dec 17, 2010 6:27 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
I just tried a similar test (using inheritance with DSL query) and it worked fine. Are you sure that everything is indexed properly? Have you inspected the index using Luke? Which version of Search are you using? If the problem persists - can you produce a testcase we can use to reproduce the problem.

--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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.