-->
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.  [ 3 posts ] 
Author Message
 Post subject: problem with Hibernate search initial index is not correct
PostPosted: Wed Sep 24, 2008 10:18 am 
Newbie

Joined: Wed Sep 24, 2008 9:53 am
Posts: 4
Hello,

I'm new to Hibernate Search and I have a problem with creating the initial index.


In my application I use JPA to create the initial index for the class Userfood:


Code:
@javax.persistence.Entity
@Table(name = "foods", schema = "xy")
@Indexed
@FullTextFilterDefs( {
   @FullTextFilterDef(name = "lockedFoods", impl = LockedUserfoodsFilter.class)
})

public class Userfood implements Serializable
{

    @Id
    @org.hibernate.search.annotations.DocumentId
    @Column(name = "id")
    private java.lang.Integer id;

    ...

    @org.hibernate.search.annotations.IndexedEmbedded(prefix="")
    @ManyToMany(cascade={CascadeType.PERSIST,CascadeType.MERGE},       fetch = javax.persistence.FetchType.EAGER)
       @JoinTable(name = "foods_ingredients", schema="xy",
             joinColumns =
                @JoinColumn(name="food_id", referencedColumnName="id"),
             inverseJoinColumns =
                @JoinColumn(name="ingredients_id", referencedColumnName="id"))
   private Set<Ingredients> ingredientsSet;

...
}



Code:
@Entity
@Table(name = "ingredients", schema = "xy")
public class Ingredients implements Serializable {

@Id
@Column(name = "id")
@org.hibernate.search.annotations.Field(name="id", index=org.hibernate.search.annotations.Index.UN_TOKENIZED, store=org.hibernate.search.annotations.Store.NO)
private Integer id;

@Column(name = "text", nullable=false)
@org.hibernate.search.annotations.Field(name="ingredients", index=org.hibernate.search.annotations.Index.TOKENIZED, store=org.hibernate.search.annotations.Store.NO)
private String text;


@org.hibernate.search.annotations.ContainedIn
@ManyToMany(mappedBy="ingredientsSet")
private Set<Userfood> userfoods;
...
}


The Problem is that the initial index does not contain all entities of the class Userfood. A small number of entities were not indexed. Where could be the problem?
Could the problem be caused by the ingredients property in the Userfood class (IndexedEmbedded) ?

I'm looking forward for your help. I'm trying to solve this problem since one week :(


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 8:00 am 
Newbie

Joined: Wed Sep 24, 2008 9:53 am
Posts: 4
Hello,

I've found the cause of my problem.
The class Userfood has a indexed property named id and I have an embedded index for ingredients without any prefix. Inside this Ingredients class I have a second property named id. So there are two indexed properties named id. This results in eventually lost of indexed Docs!!


But it whould be helpful if Lucene or hibernate search would warn the developer if there are indexed properties with equal names!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 27, 2008 2:39 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
I agree, this is Search's fault it should warn you (and refuse to startup).

please open an issue:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH

_________________
Sanne
http://in.relation.to/


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