Hi,
im working with Hibernate 3.5.1 and Search 3.2.1 final. The most stuff works, but i've
the wrapping form lucene search to JPA/Entity beans is slow.
For a legacy-issue i have to use a composite key.
I found out, that the select is very slow. This is maybe an H2 (Database) issue.
Because Hibernate Search seems to "optimize" the selects operations:
SELECT .... From .... (Key1 = ? AND Key2 = ?) OR (Key1 = ? AND Key2) OR......
However, H2 does a tablescan and is much slower than single selects.
1.) Is there any changes to change this select (dialekt?)
1b.) Should i post this as H2-bug?
I try a work-a-round with an own document-id (without composite key). Since 3.2.1 @DocmentId
is optional. But it seems impossible to annotate an other field for this.
Here is my bean:
Code:
@Entity
@Table(name = "ARTIKEL")
@Indexed
@Analyzer(impl = GermanUmlaut2Analyzer.class)
public class Artikel {
@Id
@FieldBridge(impl = com.at.od.notlauf.model.domains.ArtikelPKBridge.class)
ArtikelPK artikelPK;
...
@Column(name = "LANGTEXT", length=102)
@Field(index=Index.TOKENIZED, store=Store.NO)
String langText;
...
@DocumentId(name = "Docid")
@Column(name = "DOC_ID", unique=true)
int doc_id;
and here is the stacktrace:
Caused by: org.hibernate.annotations.common.AssertionFailure:
Two document id assigned: artikelPK and Docid at org.hibernate.search.engine.DocumentBuilderIndexedEntity.checkDocumentId(DocumentBuilderIndexedEntity.java:185)
at org.hibernate.search.engine.DocumentBuilderContainedEntity.initializeMemberLevelAnnotations(DocumentBuilderContainedEntity.java:226)
at org.hibernate.search.engine.DocumentBuilderContainedEntity.initializeClass(DocumentBuilderContainedEntity.java:173)
at org.hibernate.search.engine.DocumentBuilderContainedEntity.init(DocumentBuilderContainedEntity.java:133)
at org.hibernate.search.engine.DocumentBuilderIndexedEntity.init(DocumentBuilderIndexedEntity.java:156)
at org.hibernate.search.engine.DocumentBuilderContainedEntity.<init>(DocumentBuilderContainedEntity.java:119)
at org.hibernate.search.engine.DocumentBuilderIndexedEntity.<init>(DocumentBuilderIndexedEntity.java:148)
at org.hibernate.search.impl.SearchFactoryImpl.initDocumentBuilders(SearchFactoryImpl.java:519)
at org.hibernate.search.impl.SearchFactoryImpl.<init>(SearchFactoryImpl.java:171)
at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:126)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
... 76 more
2.) Is is possible to to set an own documentid field?
/Robert