Well, this problem you may encounter when you start to code your Compass application.
The typical symptom is the system complain the following exception.
javax.servlet.ServletException: org.compass.core.engine.SearchEngineException:
Id with path [company_objid] for alias [Company] not found.
There are several reasons this exception will be through out.
- This happens when you are using an old index but made changes to your POJO mappings and you have not yet reindex.[1]
- The object's id is null. let find more detail about this in the following code fragment
Company company = new Company();
....
mgr.save(company);
compassTemplate.save(company);//generate company object's index
//this will raise the exception, why?
Well this reason is quite easy. The company object's objid field is null but the objid field is set to be the index id and required by the compassTemplate.
So, if the code fragment changed as following then the exception will be gone.
Company company = new Company();
....
company = mgr.save(company);
compassTemplate.save(company);// now the program can generate company object's index
// with no exception raise.
Reference
- http://forum.compass-project.org/thread.jspa?messageID=294009
沒有留言:
張貼留言