2 of 2 found this page helpful

Wiki.Search

    Table of contents
    1. 1. Usage Restrictions
    2. 2. Parameters
    3. 3. Result
    4. 4. Samples
    wiki.Search(query : str, max : num?, sortby : str?, constraint : str?) : xml
    

    Insert a list of search results.

    Usage Restrictions

    1.8.1 or later

    On version 8.05 and later, constraint must not be omitted, but can be an empty string.

    Parameters

    Name Type Description
    query str query for a search 
    max num (optional) number of returned results allowed (default: 10).
    sortby str (optional) specify which field to use to sort results by (one of "score", "title", "date", "size", "wordcount"; use "-title" for reverse order; default: "score")
    constraint str (optional) additional constraints for search (default: "")

      

    Result

    a list of your search results in xml format

      

    Samples

       Output

    To create a list of search results:

    {{wiki.search("DekiScript") }} 

      

    To create a list of search results:

    {{wiki.search("String", 5) }} 

      

    To create a list of 5 most recent pages tagged as "faq", with the most recently created/edited on top:

    {{ wiki.search("tag:faq",5,"-date","") }} 

      

    To search related pages to a page you can search on its page title:

    {{ wiki.search{query: "\""..page.title.."\"", max: "10"} }}
    Was this page helpful?
    Tag page
    Viewing 9 of 9 comments: view all
    This stopped working for me in 8.05. Anyone else? edited 00:25, 18 May 2008
    Posted 14:33, 9 May 2008
    There is a regression in 8.05 where the newly added 'constraint' argument is 'nil' instead of an empty string. This causes wiki.search to fail. The workaround is to add the additional parameter like such:
    wiki.search("your query", _, _, "")
    -or-
    wiki.search{query: "your query", constraint: "" }
    Posted 11:41, 11 May 2008
    Tyvm. I rely on this function. This seems to work fine: {{ wiki.search("tag:how_to AND tag:config",19,"","") }}
    Posted 23:58, 11 May 2008
    So how do you sort by reverse date? I want to list the most recent results, not the oldest.
    Posted 07:19, 27 May 2008
    I added an example showing how to sort by reverse date. Basically you prepend - to the sortby string, e.g ,"-date",
    Posted 08:12, 20 May 2009
    @KKadow thanks for adding the sample code. much appreciated!
    Posted 18:59, 20 May 2009
    Anyone have a query string to find all pages *without* tags? To aid page checking and wiki updating.

    So far I have written the below string which is very crude.

    {{ wiki.search("type:wiki OR -title:User* OR -title:Templates OR -tag:a* OR -tag:b* OR -tag:c* OR -tag:d* OR -tag:e* OR -tag:f* OR -tag:g* OR -tag:h* OR -tag:i* OR -tag:j* OR -tag:k* OR -tag:l* OR -tag:m* OR -tag:n* OR -tag:o* OR -tag:p* OR -tag:q* OR -tag:r* OR -tag:s* OR -tag:t* OR -tag:u* OR -tag:v* OR -tag:w* OR -tag:x* OR -tag:y* OR -tag:z*",1000,"title")}} edited 23:12, 13 Jul 2009
    Posted 22:56, 13 Jul 2009
    With wiki.search("author:JacobHald", 10, -date,"") I get 10 pages, that I am the last to edit. But how do I get the full history of my edits? Not only pages where my contribution is the newest. Is there a way to search old versions as well as the newest?
    Posted 04:51, 15 Jul 2009
    Wiki.search does not work properly in my Mindtouch version 10.0.4. For instance some pages are listed twice in the result. Sortby:"title" delivers strange results. At the moment, this wiki function is useless for me.
    Posted 23:19, 24 Apr 2011
    Viewing 9 of 9 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by