The issue was discussed here:
To reproduce the problem you can extend package org.compass.core.test.all.AllTests with a new test case:
public void testAllWithTermVector2() {
CompassSession session = openSession();
CompassTransaction tr = session.beginTransaction();
for(int i = 1; i < 5; i++){
Long id = new Long(i);
A a = new A();
a.setId(id);
a.setValue1("test1");
a.setValue2("test2");
session.save("a5", a);
}
for(int i = 1; i < 5; i++){
Long id = new Long(i);
A a = new A();
a.setId(id);
a.setValue1("test1");
a.setValue2("test2");
session.save("a6", a);
}
CompassHits hits = session.find("alias:a5");
try{
for(int i = 0; i < hits.getLength(); i++){
Resource r = hits.hit(i).getResource();
TermFreqVector termInfoVector = LuceneHelper.getTermFreqVector(session, r, CompassEnvironment.All.DEFAULT_NAME);
assertNotNull(termInfoVector);
}
}catch(Exception e){
fail(e.getMessage());
}
hits = session.find("alias:a6");
//ak13: the bad case is here:
try{
for(int i = 0; i < hits.getLength(); i++){
Resource r = hits.hit(i).getResource();
TermFreqVector termInfoVector = LuceneHelper.getTermFreqVector(session, r, CompassEnvironment.All.DEFAULT_NAME);
assertNotNull(termInfoVector);
} }
}catch(Exception e){
fail(e.getMessage());
}
tr.commit();
session.close();
}
The difference to the working test cases is that I use several resources in 2 different domains and get them using session.find(..), not session.loadResource(..)
Because I've got this problem using RSEM but unittests are based on OSEM, I created unittest for my case also (behavior is the same as for OSEM: produces the same error when I use session.find(..) and works fine if I use session.loadResource(..).