cancel
Showing results for 
Search instead for 
Did you mean: 

CmisSession.query immediately after createDocument does not find the document

sepgs2004
Star Contributor
Star Contributor
CmisSession.query immediately after createDocument operation does not find the document
Same query in CMIS workbench retrieves the result
Same query issued after few seconds retrieves

It appeared to be a CmisSession cache problem

So I changed my query issuing statement as below. Still does not seem to work…


OperationContext operationContext = cmisSession.createOperationContext();
operationContext.setCacheEnabled(false);
ItemIterable<QueryResult> results = cmisSession.query(cmisQuery, false, operationContext);


The same code after a few seconds retrieve the expected results and work…



My initial session creation logic is…

Map<String, String> parameter = new HashMap<String, String>();         
parameter.put(SessionParameter.USER, this.user);
parameter.put(SessionParameter.PASSWORD, this.password);
parameter.put(SessionParameter.ATOMPUB_URL, this.host);
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

repositories = sessionFactory.getRepositories(parameter);
cmisRepository = repositories.get(0);

parameter.put(SessionParameter.REPOSITORY_ID, cmisRepository.getId());
cmisSession = sessionFactory.createSession(parameter);
Gnanasekaran Sakthivel
2 REPLIES 2

sepgs2004
Star Contributor
Star Contributor
This was working before until I added the IN_TREE condition in the cmisQuery.
Gnanasekaran Sakthivel

rjohnson
Star Contributor
Star Contributor
The issue is likely that the indexer (Solr) is asynchronous so if you create a document and then immediately search for it it is highly likely it will not be found unless you phrase your query to use the dtatabase rather than Solr.

There is a specific query type and limited syntax to "force" Alfresco to use the database rather than Solr which is only sparsely documented.