AnsweredAssumed Answered

searchService finds deleted content

Question asked by iblanco on Feb 1, 2013
Latest reply on Feb 7, 2013 by iblanco
I was having trouble with a scheduled job due to the fact that the "fts-alfresco" search I was running was returning some node references to nodes that are already deleted. I thought that might be some kind of corruption on the Lucene index because fully rebuilding the index did solve the problem. But I managed to reproduce the problem a couple of times by copying and deleting some folders so I started digging trying to figure where was I breaking the index.

But I was shocked when I executed the same query in Alfresco Share's search box and found that it didn't return the unexistent nodes, so something was wrong with my searchParameters or something like that I thought. I launched the debugger and analyzing the search that was being executed in the backend when I executed the query in Share showed that this query did also return unexisting nodes but afterwards org.alfresco.repo.javascript.Search was filtering the result and discarding unexistent ones.

That means that if you call the searchService with a query limited to for example 50 results and 20 of them are non existing you will get only 30 results. It seems like in Share this is solved by setting the limit to 502 while the real search result never returns more than 200 elements. Am I seeing and understanding it right ? That means that if by a chance there are more than 302 deleted nodes as a result of a search you might lost some results, isn't it ?

Is this the expected behaviour or am I missing something ? And if this is the expected behaviour, when are the non existing nodes really deleted from the index ? On merge time ?

To be honest I'm quite confused about this.

Outcomes