please help me to understand why hibernate search query return as results same
records twice. It is a bug or it is my mistake?
| @Entity
| @Indexed(index="UsersProfileData")
| public class UserData implements Serializable {
|
| private long id;
| private java.lang.String value;
|
| @Id
| @GeneratedValue(strategy = GenerationType.AUTO)
| @DocumentId
| 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 ();
| u1.setValue(values);
| em.persist(u);
| }
|
query for data, using *:
| FullTextEntityManager fullTextEntityManager =
|
org.hibernate.search.jpa.Search.createFullTextEntityManager(em);
| 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
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4096524#4096524
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4096524
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user