-->
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: [Hibernate Search] Duplicate results
PostPosted: Wed May 09, 2007 4:59 am 
Regular
Regular

Joined: Wed Apr 25, 2007 10:29 am
Posts: 110
Location: France
Hello, it's me again

Now, my problem is that I have duplicate results.

This is my code :
Code:
      Session s = getSessionActuelle();

      FullTextSession fullTextSession = Search.createFullTextSession(s);
   
      QueryParser parser = new QueryParser("title", new StopAnalyzer());

      String requete = "titre:enti*";

      org.apache.lucene.search.Query luceneQuery = null;
      try {
         luceneQuery = parser.parse(requete);
      } catch (ParseException e) {
         e.printStackTrace();
      }

      org.hibernate.Query fullTextQuery = fullTextSession.createFullTextQuery(luceneQuery,Entite.class);

      List result = (fullTextQuery).list(); //return a list of managed objects
      Iterator i = result.iterator();

      Entite entite1 = (Entite) i.next();
      Entite entite2 = (Entite) i.next();
      System.out.println(entite1 == entite2);


And the result is "true".

I know how I can remove duplicate Objects but I think it's not the solution :

Code:
Set setItems = new LinkedHashSet(resultList);
list.clear();
list.addAll(setItems);


Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 09, 2007 5:26 am 
Regular
Regular

Joined: Wed Apr 25, 2007 10:29 am
Posts: 110
Location: France
Maybe a problem with my indexes ...


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 11:52 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
There seems to be issues with you indexes. If you "inserted twice" an object (can happen in unit tests if you don't clean your indexes first), this is the behavior you will get.

You can for a clean reindexing by entity using fullTextSession.index();

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 1:08 pm 
Regular
Regular

Joined: Wed Apr 25, 2007 10:29 am
Posts: 110
Location: France
Thank you Emmanuel, i delete manualy the index files when I need.


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.