[
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-76?page...
]
Christian Bauer commented on HSEARCH-76:
----------------------------------------
Documentation example is also wrong for batching (yeah it is also wrong in the H3
reference docs), the batch misses the last row:
transaction = fullTextSession.beginTransaction();
//Scrollable results will avoid loading too many objects in memory
ScrollableResults results = fullTextSession.createCriteria( Email.class ).scroll(
ScrollMode.FORWARD_ONLY );
int index = 0;
while( results.next() ) {
index++;
fullTextSession.index( results.get(0) ); //index each element
if (index % batchSize == 0) s.clear(); //clear every batchSize since the queue is
processed
}
transaction.commit();
Should be:
transaction = fullTextSession.beginTransaction();
//Scrollable results will avoid loading too many objects in memory
ScrollableResults results = fullTextSession.createCriteria( Email.class ).scroll(
ScrollMode.FORWARD_ONLY );
int index = 0;
while( true ) {
index++;
fullTextSession.index( results.get(0) ); //index each element
if (index % batchSize == 0) s.clear(); //clear every batchSize since the queue is
processed
if (results.isLast())
break;
else
results.next();
}
transaction.commit();
Lazy loaded property isn't indexed properly
-------------------------------------------
Key: HSEARCH-76
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-76
Project: Hibernate Search
Issue Type: Bug
Components: engine
Affects Versions: 3.0.0.beta3
Reporter: Christian Bauer
@Column(name = "CONTENT")
@Length(min = 0, max = 32768)
@Basic(fetch = FetchType.LAZY) // Lazy loaded through bytecode instrumentation
@org.hibernate.search.annotations.Field(index =
org.hibernate.search.annotations.Index.TOKENIZED)
private String content;
I use fulltextSession.index(o) and I only get two terms indexed "text" and
"edit". I don't know where these are coming from actually, no object has
these content values.
If I trigger an o.getContent() before fulltextSession.index(o), the content is loaded
with sequential selects for the lazy property and correctly indexed.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira