-->
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: MassIndexer massIndexer = fullTextSession.createIndexer();
PostPosted: Sat Oct 16, 2010 3:09 am 
Newbie

Joined: Fri Oct 15, 2010 3:08 am
Posts: 4
Hi all,

I am using MassIndexer to create index to my database. But it is not working at the time when I am trying to debug the code it will come out from debug mode. I don't understand the cause behind this because it does not through any exception.

here is my code:
Code:
Session session=HibernateUtil.getSessionFactory().getCurrentSession();
      FullTextSession fullTextSession = Search.getFullTextSession(session);
      try {
         MassIndexer massIndexer = fullTextSession.createIndexer();         
         massIndexer.start();

         //fullTextSession.createIndexer(Book.class).startAndWait();
      } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }



Even the code :
Code:
                    fullTextSession.createIndexer(Book.class).startAndWait();
]


is also not working properly can anybody solve my indexing problem. I am new to hibernate search.

Thank you in advance


Top
 Profile  
 
 Post subject: Re: MassIndexer massIndexer = fullTextSession.createIndexer();
PostPosted: Sat Oct 16, 2010 3:42 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
hello,
to help you I'll need to see the code of the entity and that you tell me what actually happens. Could you enable logging, and verify what's in the logs?

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


Top
 Profile  
 
 Post subject: Re: MassIndexer massIndexer = fullTextSession.createIndexer();
PostPosted: Sat Oct 16, 2010 3:50 am 
Newbie

Joined: Fri Oct 15, 2010 3:08 am
Posts: 4
Hello thanks for the reply,

I don't how to enable the logging.....

but for your reference here is my entity beans code.....
Code:
package example;
...
@Entity
@Indexed
public class Book {

  @Id
  @GeneratedValue
  private Integer id;
 
  @Field(index=Index.TOKENIZED, store=Store.NO)
  private String title;
 
  @Field(index=Index.TOKENIZED, store=Store.NO)
  private String subtitle;

  @IndexedEmbedded
  @ManyToMany
  private Set<Author> authors = new HashSet<Author>();

  @Field(index = Index.UN_TOKENIZED, store = Store.YES)
  @DateBridge(resolution = Resolution.DAY)
  private Date publicationDate;
 
  public Book() {
  }
 
  // standard getters/setters follow here
  ...
}




could any body please and me any working code of hibernate search.........

Thank you in advance.


Top
 Profile  
 
 Post subject: Re: MassIndexer massIndexer = fullTextSession.createIndexer();
PostPosted: Sat Oct 16, 2010 4:56 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
could any body please and me any working code of hibernate search.........

Hello,
if you download the sources, which you can checkout from Subversion or gituub, there are many unit tests which exercise all areas of Hibernate Search;
some of these tests are "complex", but most of them are made in such a way that they are actually examples of using each different feature.

additionally you can download examples from the Seam project, some of them (like DVDStore) use Hibernate Search, so they are useful examples of fully functional applications.

Finally, if you're a Maven power users we provide a Maven archetype of Hibernate Search.


How do you know that the MassIndexer is not working properly? did you inspect the produced indexes? is it throwing any error?
To enable logging, Hibernate (and Hibernate Search too) use slf4j as logging, please refer to their documentation: you can plug in log4j or jdk's logger, in all cases you definitely want to have logging in your application.

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