Fix bug in folder search code when there are pseudo files and only one real file, the real file was not being returned in the search.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2310 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gary Spencer 2006-02-06 17:55:13 +00:00
parent 7bd656484e
commit d5c8cba194

View File

@ -108,7 +108,7 @@ public class ContentSearchContext extends SearchContext
if ( donePseudoFiles == false && pseudoList != null && index < (pseudoList.numberOfFiles() - 1)) if ( donePseudoFiles == false && pseudoList != null && index < (pseudoList.numberOfFiles() - 1))
return true; return true;
return index < (results.size() -1); return index < (results.size() - 1);
} }
/** /**
@ -146,19 +146,22 @@ public class ContentSearchContext extends SearchContext
// Copy the file information to the callers file info // Copy the file information to the callers file info
info.copyFrom( pinfo); info.copyFrom( pinfo);
// Check if we have finished with the pseudo file list, switch to the normal file list
if ( index == (pseudoList.numberOfFiles() - 1))
{
// Switch to the main file list
donePseudoFiles = true;
index = -1;
}
// Indicate that the file information is valid
return true; return true;
} }
} }
else
{
// Switch to the main file list
donePseudoFiles = true;
index = 0;
if ( results == null || results.size() == 0)
return false;
}
} }
// Get the next file info from the node search // Get the next file info from the node search
@ -226,7 +229,7 @@ public class ContentSearchContext extends SearchContext
// Switch to the main file list // Switch to the main file list
donePseudoFiles = true; donePseudoFiles = true;
index = 0; index = -1;
if ( results == null || results.size() == 0) if ( results == null || results.size() == 0)
return null; return null;