On Sep 5, 2008, at 11:05 AM, Jerome Velociter wrote:
Vincent Massol wrote:
Hi Sergiu,
On Sep 5, 2008, at 1:17 AM, Sergiu Dumitriu wrote:
Hi devs,
The first proposal is about introducing two $xwiki.countDocuments methods, one that accepts a simple hql query, and one that accepts a parametrized query and a list of parameter values. These work like searchDocuments, but instead of prefixing the query fragment with 'select doc.fullName from XWikiDocument as doc', it will prefix it with 'select count(*) from XWikiDOcument as doc'.
This will allow to count documents without using a programming- protected query, and without retrieving all the documents and count the results. Such a method is needed for paging results, for example.
Sounds good to me.
Artem, how will this be done with the Query manager?
The second proposal is a temporary hack for hiding documents. The idea is to add a new field in the XWikiDocument class, 'hidden', which will be automatically used in searchDocuments and countDocuments to filter out special documents. This is a workaround until we will be able to tag special documents or spaces, and will allow to create special documents needed for an application inside the main application's space, instead of the generic XWiki space. Such hidden pages won't appear in normal search results, the index page or the navigation panel.
-0 (close to -1) till you explain what is wrong with the solution below :)
This could also be implemented using a special Tag (like: "xwiki:hidden" for example).
I was going to say: "In general I think we need the ability to add generic metadata to a document.". however this already exists: it's called Objects! :) So I think instead of adding more and more fixed metadata we might instead want to use Objects. Either reuse the existing Tag or create a new Visibility class/objects.
What are the cons of using Objects for this feature?
Using existing Tag object is not the best solution IMHO, since it implies filtering out those "technical" tags everywhere we query tags.
Yes, I agree with you but not for the same reason. I agree because we don't have permissions on tag values so a normal users would be allowed to modify a technical tag that maybe should only be changed by admins. BTW even using a different objects, it would be ideal if the modification of the "Visibility" object be restricted to some users with appropriate rights but I don't think we have rights on objects modifications yet, do we? In any case I'm still in favor of using Objects even if we don't have these permissions but they should be added later on. Thanks -Vincent
A new object would not interfere with existing code.
Jerome.
To show these documents (for admins, for example) we could add another searchDocuments method which accepts a boolean parameter that enables or disables the filter on the 'hidden' property.
If we use an Object then we don't need to add a new API since we already have all the required APIs for manipulating objects.
Thanks -Vincent