The reason is that SMW can only sort by properties that are part of the core query. Print statements such as "?Date" may or may not lead to one (or more) outputs per query result, but are not used in the initial SQL query (so as not to increase the number of result rows via printouts).
So what you need to do is to add Date to the query: {{#ask: [[Category:News]] [[Date::+]] | ... I guess we should add this automatically if "sort" is used, but the potentially complex recursive query structure makes this a little difficult. But note that this is not a change in behaviour as compared to <ask>. Cheers, Markus On Mittwoch, 12. Dezember 2007, cnit wrote: > Markus (or perhaps someone else), > Can you please give a hint, why with my query > > ---- > {{#ask: [[Category:News]] | > ?Date| > sort=Date| > order=descending| > limit=3| > format=template| > template=newsrow| > default=There was no news| > searchlabel=Browse all news...| > }} > ---- > In the SMWSQLStore::createSQLQuery() > $description is NEVER an instance of SMWSomeProperty, so it doesn't > even have a chance to set $this->m_sortfield :-( > > I've either tried ?Date=*| > ?Date=+| > but no luck.. > > So, when it gets to the > in SMW_SQLStore.php, where's the following code: > ---- > if ( $smwgQSortingSupport ) { > $order = $query->ascending ? 'ASC' : 'DESC'; > if ( ($this->m_sortfield == false) && > ($this->m_sortkey == false) ) { $sql_options['ORDER BY'] = > "$pagetable.page_title $order "; // default } elseif ($this->m_sortfield != > false) { > $sql_options['ORDER BY'] = > $this->m_sortfield . " $order "; } // else: sortkey given but not found: do > not sort } > ---- > > my case is always "sortkey given but not found: do not sort" ? > > My Property:Date does exists and correctly defined, and it has the > lists of pages that use this property. > Dmitriy -- Markus Krötzsch Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe phone +49 (0)721 608 7362 fax +49 (0)721 608 5998 [EMAIL PROTECTED] www http://korrekt.org
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel