<?xml version="1.0" encoding="utf-8"?>
<KScriptSetting>
  <Name>ContentQuery</Name>
  <Description>Query the table with paged result.</Description>
  <Example>
    <![CDATA[
 <script engine="kscript"> 
    var all = k.site.textContents.query("age>4").orderBy("age").skip(1).take(6);   
</script>

<div k-foreach="item all">
    <h2 k-content="item.title">Welcome!</h2>
    <p k-content="item.age">Welcome to Kooboo CMS</p> 
</div>
        ]]>
  </Example>
  <Props>
    <Property>
      <Name>skipcount</Name>
      <Description>the number of items that will be skipped</Description>
      <Type>Int32</Type>
    </Property>
    <Property>
      <Name>Ascending</Name>
      <Description>Is ascending order</Description>
      <Type>boolean</Type>
    </Property>
    <Property>
      <Name>OrderByField</Name>
      <Description>The field name to order by</Description>
      <Type>string</Type>
    </Property>
    <Property>
      <Name>SearchCondition</Name>
      <Description>The search query</Description>
      <Type>Query</Type>
    </Property>
  </Props>
  <Methods>
    <Method>
      <Name>skip</Name>
      <Description>skip</Description>
      <Example>
        <![CDATA[
        var values =  k.site.textContents.query("age>4").orderBy("age").skip(1).take(6);   
	  ]]></Example>
      <Params>
        <Param>
          <Name>skip</Name>
          <Description>skip count</Description>
          <Type>number</Type>
        </Param>
      </Params>
      <ReturnType>ContentQuery</ReturnType>
    </Method>
    
    <Method>
      <Name>orderBy</Name>
      <Description>the order by field name</Description>
      <Example>
        <![CDATA[
       var values =  k.site.textContents.query("age>4").orderBy("age").take(6);   
		]]></Example>
      <Params>
        <Param>
          <Name>fieldname</Name>
          <Description>fieldname</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>ContentQuery</ReturnType>
    </Method>
    <Method>
      <Name>OrderByDescending</Name>
      <Description>the field name to order by in Descending order</Description>
      <Example>
        <![CDATA[
       var values =  k.site.textContents.query("age>4").orderByDescending("age").take(6);  
		]]></Example>
      <Params>
        <Param>
          <Name>fieldname</Name>
          <Description>fieldname</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>ContentQuery</ReturnType>
    </Method>
    <Method>
      <Name>take</Name>
      <Description>Return an array of the TextContentObjects.</Description>
      <Example>
        <![CDATA[
        var values =  k.site.textContents.query("age>4").take(6);  
		]]></Example>
      <Params>
        <Param>
          <Name>count</Name>
          <Description>count</Description>
          <Type>number</Type>
        </Param>
      </Params>
      <ReturnType>TextContentObject</ReturnType>
    </Method>
    <Method>
      <Name>count</Name>
      <Description>count</Description>
      <Example>
        <![CDATA[
        var count = k.site.textContents.query("age>4").count();
		]]> 
      </Example>
      <Params />
      <ReturnType>number</ReturnType>
    </Method>
  </Methods>
</KScriptSetting>