[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-76) Lazy loaded property isn't indexed properly

Emmanuel Bernard (JIRA) noreply at atlassian.com
Tue Jul 31 13:56:11 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-76?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27687 ] 

Emmanuel Bernard commented on HSEARCH-76:
-----------------------------------------

The code does not lose the last row. I have it working in the test suite

		FullTextSession s = Search.createFullTextSession( openSession() );
		Transaction tx = s.beginTransaction();
		int loop = 14;
		for (int i = 0; i < loop; i++) {
			s.connection().createStatement().executeUpdate( "insert into Email(id, title, body, header) values( + "
					+ ( i + 1 ) + ", 'Bob Sponge', 'Meet the guys who create the software', 'nope')" );
		}
		tx.commit();
		s.close();

		//check non created object does get found!!1
		s = new FullTextSessionImpl( openSession() );
		tx = s.beginTransaction();
		ScrollableResults results = s.createCriteria( Email.class ).scroll( ScrollMode.FORWARD_ONLY );
		int index = 0;
		while ( results.next() ) {
			index++;
			s.index( results.get( 0 ) );
			if ( index % 5 == 0 ) s.clear();
		}
		tx.commit();
		s.clear();
		tx = s.beginTransaction();
		QueryParser parser = new QueryParser( "id", new StopAnalyzer() );
		List result = s.createFullTextQuery( parser.parse( "body:create" ) ).list();
		assertEquals( 14, result.size() );
		for (Object object : result) {
			s.delete( object );
		}
		tx.commit();
		s.close();

> 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
>             Fix For: 3.0.0.beta4
>
>
>     @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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list