0 Replies Latest reply on Oct 18, 2007 8:52 AM by serj f

    hibernate search, query return same record twice when use *

    serj f Newbie

      please help me to understand why hibernate search query return as results same records twice. It is a bug or it is my mistake?

      public class UserData implements Serializable {
       private long id;
       private java.lang.String value;
       @GeneratedValue(strategy = GenerationType.AUTO)
       public long getId() {
       return id;
       public void setId(long id) {
       this.id = id;
       @Field(name="summary", index=org.hibernate.search.annotations.Index.UN_TOKENIZED, store=Store.YES)
       public java.lang.String getValue() {
       return value;
       public void setValue(java.lang.String comment) {
       this.value = comment;

      adding data to table from session bean:

      String[] values = {"1","2","ab 1","ab 2"}
      for(int i=0;i<4;i++){
       UserData u = new UserData ();

      query for data, using *:

       FullTextEntityManager fullTextEntityManager =
       QueryParser parser = new QueryParser("id", new KeywordAnalyzer() );
       org.apache.lucene.search.Query q = parser.parse( "summary:ab*" );
       org.hibernate.search.jpa.FullTextQuery hQuery = fullTextEntityManager.createFullTextQuery(q,UserData.class);
       List result = hQuery.getResultList();
       System.out.println("\n\t*** RESULTS: "+hQuery.getResultSize());

      thanks for help