wiki.GetSearch(query : str, max : num, sortBy : str, constraint : str) : list

Get list of found page and file objects.

Usage Restrictions

8.05.1 or later.

Parameters

Name Type Description
query str search query 
max num  (optional, default: 10): max results
sortBy str (optional, one of "score", "title", "date", "size", "wordcount"; use "-title" for reverse order; default: "score"): sort field
constraint str (optional, default: ""): additional search constraint

Result

Returns a list of page and file objects.  The list is empty if no results where found.

Usage Example

Create a list of the ten most viewed pages in your wiki containing the word 'test'.

{{
foreach(var p in wiki.getsearch('test',10,'-viewcount')) {
   web.link(p.path,p.name);
   web.html('<br>');
}
}}

Samples

  Output

Find all objects containing the keyword "deki" and constraint search to only content that is tagged with "extensions":

{{ wiki.getsearch('deki', _, _, 'tag:extensions') }} 
[ { api : "http://developer.mindtouch.com/@api/deki/pages/9977", author : "local://1fce4178a053410fad19474e74cccf8b/deki/$user", comments : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagecomments", date : "Fri, 09 May 2008 08:18:17 GMT", editsummary : "1 words added, 1 words removed", feed : "http://developer.mindtouch.com/@api/deki/pages/9977/feed", files : "local://1fce4178a053410fad19474e74cccf8b/deki/$files", fronturi : "http://developer.mindtouch.com/App_Catalog/Shell_Output", id : 9977, ishidden : false, language : nil, mime : "application/x.deki0702+xml", name : "Shell_Output", namespace : "", parent : "local://1fce4178a053410fad19474e74cccf8b/deki/$page", parents : "local://1fce4178a053410fad19474e74cccf8b/deki/$parents", path : "App_Catalog/Shell_Output", properties : "local://1fce4178a053410fad19474e74cccf8b/deki/$pageprops", redirect : nil, revision : 9, revisions : "local://1fce4178a053410fad19474e74cccf8b/deki/$revisions", subpages : "local://1fce4178a053410fad19474e74cccf8b/deki/$subpages", tags : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagetags", talkuri : "http://developer.mindtouch.com/Talk:App_Catalog/Shell_Output", text : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagetext", title : "Shell Output", toc : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagetoc", unprefixedpath : "App_Catalog/Shell_Output", uri : "http://developer.mindtouch.com/App_Catalog/Shell_Output", viewcount : 548, xml : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagexml" }, { api : "http://developer.mindtouch.com/@api/deki/pages/13154", author : "local://1fce4178a053410fad19474e74cccf8b/deki/$user", comments : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagecomments", date : "Fri, 11 Jul 2008 02:50:44 GMT", editsummary : "100 words added", feed : "http://developer.mindtouch.com/@api/deki/pages/13154/feed", files : "local://1fce4178a053410fad19474e74cccf8b/deki/$files", fronturi : "http://developer.mindtouch.com/App_Catalog/Subversion_(with_support_for_bugtraq_properties)", id : 13154, ishidden : false, language : nil, mime : "application/x.deki0805+xml", name : "Subversion_(with_support_for_bugtraq_properties)", namespace : "", parent : "local://1fce4178a053410fad19474e74cccf8b/deki/$page", parents : "local://1fce4178a053410fad19474e74cccf8b/deki/$parents", path : "App_Catalog/Subversion_(with_support_for_bugtraq_properties)", properties : "local://1fce4178a053410fad19474e74cccf8b/deki/$pageprops", redirect : nil, revision : 6, revisions : "local://1fce4178a053410fad19474e74cccf8b/deki/$revisions", subpages : "local://1fce4178a053410fad19474e74cccf8b/deki/$subpages", tags : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagetags", talkuri : "http://developer.mindtouch.com/Talk:App_Catalog/Subversion_(with_support_for_bugtraq_properties)", text : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagetext", title : "Subversion (with support for bugtraq properties)", toc : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagetoc", unprefixedpath : "App_Catalog/Subversion_(with_support_for_bugtraq_properties)", uri : "http://developer.mindtouch.com/App_Catalog/Subversion_(with_support_for_bugtraq_properties)", viewcount : 630, xml : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagexml" }, { api : "http://developer.mindtouch.com/@api/deki/pages/34572", author : "local://1fce4178a053410fad19474e74cccf8b/deki/$user", comments : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagecomments", date : "Mon, 11 Jan 2010 07:20:22 GMT", editsummary : "2 words added", feed : "http://developer.mindtouch.com/@api/deki/pages/34572/feed", files : "local://1fce4178a053410fad19474e74cccf8b/deki/$files", fronturi : "http://developer.mindtouch.com/User:qrof/OracleService", id : 34572, ishidden : false, language : nil, mime : "application/x.deki0805+xml", name : "OracleService", namespace : "User", namespaceuser : "local://1fce4178a053410fad19474e74cccf8b/deki/$user", parent : "local://1fce4178a053410fad19474e74cccf8b/deki/$page", parents : "local://1fce4178a053410fad19474e74cccf8b/deki/$parents", path : "User:qrof/OracleService", properties : "local://1fce4178a053410fad19474e74cccf8b/deki/$pageprops", redirect : nil, revision : 5, revisions : "local://1fce4178a053410fad19474e74cccf8b/deki/$revisions", subpages : "local://1fce4178a053410fad19474e74cccf8b/deki/$subpages", tags : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagetags", talkuri : "http://developer.mindtouch.com/User_talk:qrof/OracleService", text : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagetext", title : "OracleService", toc : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagetoc", unprefixedpath : "qrof/OracleService", uri : "http://developer.mindtouch.com/User:qrof/OracleService", viewcount : 272, xml : "local://1fce4178a053410fad19474e74cccf8b/deki/$pagexml" } ]

 

 

Tag page
Viewing 1 of 1 comments: view all
{{ foreach(var p in wiki.getsearch('test',10,'-viewcount')) { web.link(p.path,p.name); web.html('<br />
'); } }} does not breakline properly.

better is something like
<div foreach="var p in wiki.getsearch('test',10,'-viewcount')">{{ web.link(p.path,p.name) }} <br /></div> edited 14:10, 2 Jun 2009
Posted 13:54, 2 Jun 2009
Viewing 1 of 1 comments: view all
You must login to post a comment.