-->
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.  [ 4 posts ] 
Author Message
 Post subject: Lucene and Joined Entities
PostPosted: Sat Sep 30, 2006 11:42 am 
Newbie

Joined: Sat Sep 30, 2006 11:33 am
Posts: 2
I have been reading and investigating and not had much luck. Is there a way to tie joined entities into the same index as the main entity. For example:

Code:
@Entity
@Indexed(index="indexes/foo")
public class Foo
    private Long id;
    private Set<Bar> bars = new HashSet<Bars>();

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Keyword(id=true)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

   @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    public Set<Bar> getBars() {
        return bars;
    }

    public void setBars(Set<Bar> bars) {
        this.bars = bars;
    }
}


How do I get Bars to be indexed and searchable as part of the same index, but return the found Foo class when matched?

_________________
;//implemented by dave


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 01, 2006 12:13 am 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
AFAIK one index is defined for one or multiple columns on one table. Since you have two classes in a one-to-many relationship I assume that 2 tables are used and in the Bar table you store the parent id of the first table. You can define an index that will include the parent id and some other column in bar. Is that what you have in mind? If so you can always ALTER the table to add the proper index.

Not sure if this helps, it is likely that I misunderstood your question...

Marius


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 01, 2006 11:42 am 
Newbie

Joined: Sat Sep 30, 2006 11:33 am
Posts: 2
Thanks for the reply, but I think you did misunderstand. I was speaking of Lucene indexes, not database indexes. But, you did make me think that perhaps I can just tie the @Keyword(id=true) to the Foo.id instead of the Bar.id . . .

_________________
;//implemented by dave


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 13, 2006 9:51 am 
Newbie

Joined: Tue Oct 10, 2006 2:38 pm
Posts: 17
hi,

did you find any solution? I'm trying to create a lucene index from 2 joined entities... but no luck until now.

can you help with some ideeas?

many thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.