Hello List;

I am trying to implement hibernate search with IndexedEmbedded on my pojos which are associated with manytoone.

I have two pojo: Diary.java and User.java. the related code segments are listed below:


=================Diary.java=======================

@Entity(name="tr.com.yazmanak.portal.dal.yazmanak.diary.Diary")

@Table(name="yazmanak_diary")
@Indexed
public class Diary extends BasePojo{
    @ManyToOne
    @JoinColumn(name="user_fk")
    @IndexedEmbedded
    private User user;

/* other columns and getter/setter functions omitted*/

}





=================User.java=======================

 */
@Entity(name="tr.com.yazmanak.portal.dal.user.User")

@Table(name="yazmanak_user")
@Indexed
public class User extends BasePojo {

    @Column(name="name")
    @Field(name="name",index=Index.TOKENIZED,store=Store.NO)
    @FieldBridge(impl=StringBridge.class)
    private String name;
   
    @OneToMany(mappedBy="user",fetch=FetchType.LAZY,targetEntity=Diary.class)
    @ContainedIn
    private Set<Diary> diaries;

}




I want to search user name while searching on Diary class. My search test class is below:

==================SearchTest.java===================

public class SearchTest{
   
    public static List searchByKeyword2(FullTextSession fs) throws org.apache.lucene.queryParser.ParseException {
        org.apache.lucene.queryParser.QueryParser parser =
            new QueryParser("id", new StandardAnalyzer() );

        org.apache.lucene.search.Query luceneQuery = parser.parse( "user.name:halil And content:veli");
        org.hibernate.Query fullTextQuery = fs.createFullTextQuery( luceneQuery,Diary.class );
        List result = fullTextQuery.list(); //return a list of managed objects 
        return result;
    }
   
}


=====================end of codes========================


I want to do search with user.name whike querying onn Diary pojo. But i couldnt. I search the net for 2 days. Some people encounter the same problem and some solves also.

but i couldnt what is the problem? any help? By the way, i can search on other columns but i couldnt search on associated columns such as manytone. for example, above one.


thank you very much,

regards,

-Halil AĐIN