mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Fix for ALF-10797 - "Recently added" and "Recently modified" sections in "My content" page are empty
- addition of index control aspect to surf-config objects - config xml files no longer indexed at all - refactoring of My Profile user contents fts-alfresco queries to search specific known containers only rather than all git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31288 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.lib.js">
|
||||
|
||||
function getContents(user, type, maxResults)
|
||||
{
|
||||
var padZeros = function padZeros(number)
|
||||
var maxResults = (args.maxResults !== undefined) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS;
|
||||
|
||||
function padZeros(number)
|
||||
{
|
||||
return (number < 10) ? '0' + number : number;
|
||||
}
|
||||
|
||||
function getContents(user, type)
|
||||
{
|
||||
// set range to within last 28 days
|
||||
var date = new Date();
|
||||
var toQuery = date.getFullYear() + "-" + padZeros((date.getMonth()+1)) + "-" + padZeros(date.getDate());
|
||||
@@ -14,35 +16,75 @@ function getContents(user, type, maxResults)
|
||||
var fromQuery = date.getFullYear() + "-" + padZeros((date.getMonth()+1)) + "-" + padZeros(date.getDate());
|
||||
|
||||
var userProperty = (type == 'created') ? 'creator' : 'modifier';
|
||||
var query = 'PATH:"/*/st:sites/*/*//*" ' +
|
||||
'AND +@cm:' + userProperty + ':"' + user + '" ' +
|
||||
'AND +@cm:' + type + ':["' + fromQuery + '" TO "' + toQuery + '"] ' +
|
||||
'AND +TYPE:"cm:content" ' +
|
||||
'AND -TYPE:"ia:calendarEvent" ' +
|
||||
'AND -TYPE:"dl:dataListItem" ';
|
||||
|
||||
// perform fts-alfresco language query
|
||||
var getBlogPostsQuery = function getBlogPosts()
|
||||
{
|
||||
return 'PATH:"/app:company_home/st:sites/*/cm:blog/*" ' +
|
||||
'AND +TYPE:"cm:content" ' +
|
||||
'AND +@cm:' + userProperty + ':"' + user + '" ' +
|
||||
'AND +@cm:' + type + ':["' + fromQuery + '" TO "' + toQuery + '"]';
|
||||
};
|
||||
|
||||
var getWikiPagesQuery = function getWikiPagesQuery()
|
||||
{
|
||||
return 'PATH:"/app:company_home/st:sites/*/cm:wiki/*" ' +
|
||||
'AND +TYPE:"cm:content" ' +
|
||||
'AND +@cm:' + userProperty + ':"' + user + '" ' +
|
||||
'AND +@cm:' + type + ':["' + fromQuery + '" TO "' + toQuery + '"]';
|
||||
};
|
||||
|
||||
var getDiscussionsQuery = function getDiscussionsQuery()
|
||||
{
|
||||
return 'PATH:"/app:company_home/st:sites/*/cm:discussions//*" ' +
|
||||
'AND +TYPE:"fm:post" ' +
|
||||
'AND +@cm:' + userProperty + ':"' + user + '" ' +
|
||||
'AND +@cm:' + type + ':["' + fromQuery + '" TO "' + toQuery + '"]';
|
||||
};
|
||||
|
||||
var getDocumentsQuery = function getDocumentsQuery()
|
||||
{
|
||||
return 'PATH:"/app:company_home/st:sites/*/cm:documentLibrary//*" ' +
|
||||
'AND +TYPE:"cm:content" ' +
|
||||
'AND +@cm:' + userProperty + ':"' + user + '" ' +
|
||||
'AND +@cm:' + type + ':["' + fromQuery + '" TO "' + toQuery + '"]';
|
||||
};
|
||||
|
||||
var sortColumns = [];
|
||||
sortColumns.push(
|
||||
{
|
||||
column: "@" + utils.longQName("cm:" + type),
|
||||
ascending: false
|
||||
});
|
||||
|
||||
var queryDef = {
|
||||
query: query,
|
||||
query: "",
|
||||
language: "fts-alfresco",
|
||||
page: {maxItems: maxResults},
|
||||
onerror: "no-results",
|
||||
sort: sortColumns
|
||||
};
|
||||
var nodes = search.query(queryDef);
|
||||
|
||||
// reset processed results (in search.lib.js)
|
||||
processedCache = {}
|
||||
return processResults(nodes, maxResults);
|
||||
// perform fts-alfresco language queries
|
||||
var results;
|
||||
queryDef.query = getBlogPostsQuery();
|
||||
results = search.query(queryDef);
|
||||
queryDef.query = getWikiPagesQuery();
|
||||
results = results.concat(search.query(queryDef));
|
||||
queryDef.query = getDiscussionsQuery();
|
||||
results = results.concat(search.query(queryDef));
|
||||
queryDef.query = getDocumentsQuery();
|
||||
results = results.concat(search.query(queryDef));
|
||||
|
||||
results.sort(function(a, b)
|
||||
{
|
||||
var date1 = a.properties[type].getTime(),
|
||||
date2 = b.properties[type].getTime();
|
||||
return (date1 < date2) ? 1 : (date1 > date2) ? -1 : 0;
|
||||
}
|
||||
);
|
||||
|
||||
var maxResults = (args.maxResults !== undefined) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS;
|
||||
return processResults(results, maxResults);
|
||||
}
|
||||
|
||||
model.data = [];
|
||||
model.data['created'] = getContents(args.user, 'created', maxResults);
|
||||
|
@@ -72,7 +72,7 @@ function getPersonDisplayName(userId)
|
||||
* Cache to not display twice the same element (e.g. if two comments of the
|
||||
* same blog post match the search criteria
|
||||
*/
|
||||
var processedCache = {};
|
||||
var processedCache;
|
||||
function checkProcessedCache(key)
|
||||
{
|
||||
var found = processedCache.hasOwnProperty(key);
|
||||
@@ -552,6 +552,8 @@ function splitQNamePath(node)
|
||||
*/
|
||||
function processResults(nodes, maxResults)
|
||||
{
|
||||
// empty cache state
|
||||
processedCache = {};
|
||||
var results = [],
|
||||
added = 0,
|
||||
parts,
|
||||
|
@@ -354,6 +354,9 @@ public class ADMRemoteStore extends BaseRemoteStore
|
||||
}
|
||||
FileInfo fileInfo = fileFolderService.create(
|
||||
parentFolder.getNodeRef(), encpath.substring(off + 1), ContentModel.TYPE_CONTENT);
|
||||
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(1, 1.0f);
|
||||
aspectProperties.put(ContentModel.PROP_IS_INDEXED, false);
|
||||
nodeService.addAspect(fileInfo.getNodeRef(), ContentModel.ASPECT_INDEX_CONTROL, aspectProperties);
|
||||
contentService.getWriter(
|
||||
fileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true).putContent(content);
|
||||
if (logger.isDebugEnabled())
|
||||
|
Reference in New Issue
Block a user