On 11/03/2010 07:47 PM, Chris Wagner wrote:
Hello,
I am having some issues with the "order by" clause in HQL - the following
query:
$xwiki.searchDocuments("where doc.hidden = false and doc.id='${doc.parent}'
order by doc.title asc")
is returning the expected set of documents, but the title order is erratic.
The documents are reordered, but it is not alphabetized as anticipated.
Instead, there are several alphabetized "spurts" -- for example, I have
'A',
'C', 'P', ... 'A', 'A', 'B', 'C',
'D', 'E', etc. Within one of these spans,
no items appear out of order, but the 'span' separation is not expected or
desired. Is there a common issue that I could be overlooking?
There are two types of titles.
Document titles are stored in the database as the doc.title field, and
they are editable in the editor above the content.
Display titles are computed from the document title, first heading from
the content, or the document name, depending on which one exists, in
this order. Unfortunately it is not possible to see the display title in
queries.
I'm not sure, but I think that your problem is caused by this difference
between display and document titles. The first set of documents has an
empty document title, but in the UI you see their computed display
title. The second set of documents is correctly ordered by their
persisted document title.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/