Added by Max Pfingsthorn, last edited by Bart van der Schans on Jun 04, 2007  (view change)

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

The REPLACE method

The REPLACE method can be used to replace text in a number of given resources. It is important that all referenced resources are plain text files, like XML files. Do not reference binary files, like PDFs.

The input format looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<hp:replace-request xmlns:hp="http://hippo.nl/slide">
  <hp:replace>test</hp:replace>
  <hp:with>something else</hp:with>
  <hp:in>
    <hp:resource>/files/default.preview/test.xml</hp:resource>
    <hp:resource>/files/default.preview/anothertest.xml</hp:resource>
  </hp:in>
</hp:replace-request>

The method actually uses Java's regular expressions, so you can write a pattern in <hp:replace/>. If a file's content matches, Matcher.replaceAll() is used.

A sample response looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<hippo:replace-response xmlns:hippo="http://hippo.nl/slide">
    <hippo:resource>
        <hippo:href>/files/default.preview/test.xml</hippo:href>
        <hippo:status>HTTP/1.1 200 OK</hippo:status>
    </hippo:resource>
    <hippo:resource>
        <hippo:href>/files/default.preview/anothertest.xml</hippo:href>
        <hippo:status>HTTP/1.1 200 OK</hippo:status>
        <hippo:error>Nothing to replace.</hippo:error>
    </hippo:resource>
</hippo:replace-response>

The extra "error" message indicates that anothertest.xml did not match the replace expression. Errors and HTTP codes will be listed per indicated resource.

The FACETS method

This feature is only available for version 1.2.7 and up.

The FACETS method was implemented to enable "faceted browsing".

It can list unique values of properties and filter out values that are not contained in documents matching a query. It also lists how many documents contain a specific unique value. The syntax of the query is exactly the same as for DASLs (see 06. Using DASL Queries for a description).

However, instead of meaning "give me all documents that match this query and show their respective properties", using the DASL with the FACETS method means "give me all unique values of the indicated properties over all documents matching this query".

A sample query (very simple):

<D:searchrequest xmlns:D="DAV:" xmlns:hc="http://hippo.nl/cms/1.0">
  <D:basicsearch>
    <D:select>
      <D:prop>
        <hc:type/>
        <hc:keywords/>
      </D:prop>
    </D:select>
    <D:from>
      <D:scope>
        <D:href></D:href>
        <D:depth>infinity</D:depth>
      </D:scope>
    </D:from>
  </D:basicsearch>
</D:searchrequest>

So, if you use the webdav transformer, your dasl would look something like:

<request xmlns="http://hippo.nl/webdav/1.0"
  xmlns:d="DAV:"
  xmlns:h="http://hippo.nl/cms/1.0"
  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
  xmlns:slide="http://jakarta.apache.org/slide/"
  target="${target}"
  method="FACETS"
  <header name="Depth" value="${depth}"/>
  <body>
      block above here
  </body>
</request>

A sample response:

<hippo:facets xmlns:hippo="http://hippo.nl/slide">
    <type xmlns="http://hippo.nl/cms/1.0">
        <hippo:value hits="113">agenda</hippo:value>
        <hippo:value hits="1053">asset</hippo:value>
        <hippo:value hits="38">begrippen</hippo:value>
        <hippo:value hits="701">collection</hippo:value>
        <hippo:value hits="15">faq</hippo:value>
        <hippo:value hits="4">list</hippo:value>
        <hippo:value hits="4">menu</hippo:value>
        <hippo:value hits="36">nieuws</hippo:value>
        <hippo:value hits="729">plattetekst</hippo:value>
        <hippo:value hits="51">publicatie</hippo:value>
        <hippo:value hits="8">regelingen</hippo:value>
        <hippo:value hits="3">thesaurus</hippo:value>
        <hippo:value hits="11">vacature</hippo:value>
    </type>
    <keywords xmlns="http://hippo.nl/cms/1.0">
        <hippo:value hits="960"/>
        <hippo:value hits="1">acute hulpverlening</hippo:value>
        <hippo:value hits="1">adresboeken</hippo:value>
        <hippo:value hits="2">automatisering</hippo:value>
        <hippo:value hits="1">binnenklimaat</hippo:value>
        <hippo:value hits="2">communicatie</hippo:value>
        <hippo:value hits="4">gedragsregels</hippo:value>
        <hippo:value hits="1">test</hippo:value>
        <hippo:value hits="1">hygiene</hippo:value>
        <hippo:value hits="1">infektieziekten</hippo:value>
        <hippo:value hits="1">medische milieukunde</hippo:value>
        <hippo:value hits="1">personeel</hippo:value>
        <hippo:value hits="1">soa</hippo:value>
        <hippo:value hits="2">werktijden</hippo:value>
        <hippo:value hits="1">medische milieukunde</hippo:value>
    </keywords>
</hippo:facets>