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?
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