SEARCH

The SEARCH method is used to perform searches on the server for objects which match the search request. DocMoto has the DAV:basicsearch implemented.

DAV:basicsearch

A DAV:basicsearch request is made up of three required elements and a further two optional elements.

Required:

  • Select: The properties to be returned
  • From: The scope of the search, using the depth option this can be extended
  • Where: The search condition

Optional:

  • Orderby: Order of the result set
  • Limit: The maximum number of results which may be returned

(This is very similar to SQL searches, tell it what to return, from which area and what to look for, with optional clauses on how the results should be returned)

DAV:basicsearch Elements

basicsearch

<!ELEMENT basicsearch (select, from, where?, orderby?, limit?)>

The search request is contained within a basicsearch element

select

<!ELEMENT select (allprop|prop)>

The properties to be displayed, either all properties, or a list of specific properties

from

<!ELEMENT scope (href, depth, include-versions?)>
<!ELEMENT include-versions>

The scope of the search.

The href may either be a relative or absolute reference. If a relative reference is used it will be relative to the request URI.

The depth is used to extend the search if the href is a collection. If the href is not a collection the depth value will be ignored. (Note: It is still a required element)

The element include-versions informs the server to include all versions in the search scope.

where

Defines the search condition. Each condition will evaluate to either TRUE, FALSE, UNKNOWN. If the result is TRUE it will be included in the search result.

There are five different types of operations:

  • Computation:
    • eq
    • lt
    • gt
    • lte
    • gte
  • Logical: and | or | not
  • Special: is-collection | is-defined | language-defined | language-matches
  • String: like
  • Content: contains

See the example searches for further information.

orderby

<!ELEMENT orderby (order+) >
<!ELEMENT order ((prop | score), (ascending | descending)?)>
<!ATTLIST order caseless (yes|no)>
<!ELEMENT ascending>
<!ELEMENT descending>

States in which order the results should be returned.

limit

<!ELEMENT limit (nresults)>
<!ELEMENT nresults (#PCDATA)>

An unsigned integer is used to limit the number of results returned by the server.

 

Example: Searching for a string

Request

Returns the <version-name> of objects whose <displayname> contains the string "howto"

<?xml version='1.0' encoding='utf-8'?>
  <searchrequest xmlns='DAV:'>
    <basicsearch>
      <select>
        <prop>
          <version-name/>
        </prop>
      </select>
      <from>
        <scope>
	  <href>http://$server</href>
          <depth>infinity</depth>
        </scope>
      </from>
      <where>
        <like caseless='yes'>
          <prop><displayname/></prop>
          <literal>%howto%</literal> 
        </like>
      </where>
    </basicsearch>
  </searchrequest>

Response

HTTP/1.1 207 Multi-Status
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<multistatus xmlns="DAV:">
  <response>
    <href>http://192.168.1.7:3983/Example/Files/howto.txt</href>
    <propstat>
      <prop>
        <version-name>3</version-name>
      </prop>
    <status>HTTP/1.1 200 OK</status>
    </propstat>
  </response>
</multistatus>

Copyright 2013 CHLSoftware. All rights reserved. All trademarks acknowledged.