We're updating the issue view to help you get more done. 

Simple entity changes not reflected in index

Description

I was unable to find a unit test which tests if an entity change on a searchable String field (probably also other types) is reflected in the index. That's probably the reason I came across this serious issue.

I have changed an existing test to see if my expectations were true, and indeed: solely changing a String property (searchable) of an entity won't trigger an update to the index.

I will add a unit test for this particular case. For now, the failing code from an altered existing test:

snippet from altered NestedEmbeddedTest.java

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 s.clear(); tx = s.beginTransaction(); product = ( Product ) s.get( Product.class, product.getId() ); product.setNwField("value1"); tx.commit(); s.clear(); session = Search.getFullTextSession( s ); tx = s.beginTransaction(); QueryParser parser2 = new QueryParser( TestConstants.getTargetLuceneVersion(), "nwField", TestConstants.standardAnalyzer ); query = parser2.parse( "value1" ); result = session.createFullTextQuery( query, Product.class ).list(); assertEquals( "change on simple string field not reflected in root index", 1, result.size() ); tx.commit();

addition to Product.java

1 2 3 4 5 6 7 8 9 10 @Field(store = Store.YES) private String nwField; public String getNwField(){ return nwField; } public void setNwField(String fld){ nwField = fld; }

Environment

Unit test on Ubuntu 11.10 x64

Status

Assignee

Unassigned

Reporter

Elmer van Chastelet

Labels

Suitable for new contributors

Yes, likely

Components

Affects versions

3.4.2.Final
4.1.0.CR2

Priority

Critical