On Sep 5, 2008, at 12:08 PM, Jean-Vincent Drean
wrote:
On Fri, Sep 5, 2008 at 11:58 AM, Vincent Massol
<vincent(a)massol.net>
wrote:
> 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?
At first sight I'd say that using objects (including current tag
feature) would lead to complex queries.
Yes but that's an API problem not a design one.
If our API makes it complex to do queries on objects then we should
fix it. Not do workarounds! Because if we do this then we
acknowledge
that the whole foundation of XWiki is bad (i.e. Class/Objects don't
work). That would be a shame :)
New XWiki Query Language is targets this problem.
There is easy to query objects on xwql.
example:
If XWiki.Hidden is just a document flag:
"from Document as doc, doc.object(XWiki.Hidden) as h"
If not:
"from Document as doc left join doc.object(XWiki.Visibility) as v
where v is null or v.hidden=false"
We can also introduce special syntax "doc.object?(XWiki.Visibility)"
for
left joins:
"from Document as doc, doc.object?(XWiki.Visibility) as v
where v is null or v.hidden=false"
or even:
"where doc.object?(XWiki.Visibility).hidden=false"