Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6415EDEA8 for ; Mon, 16 Jul 2012 18:52:06 +0000 (UTC) Received: (qmail 42966 invoked by uid 500); 16 Jul 2012 18:52:06 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 42926 invoked by uid 500); 16 Jul 2012 18:52:06 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 42917 invoked by uid 99); 16 Jul 2012 18:52:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jul 2012 18:52:06 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of victor.giordano@globant.com designates 74.125.149.66 as permitted sender) Received: from [74.125.149.66] (HELO na3sys009aob101.obsmtp.com) (74.125.149.66) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jul 2012 18:51:55 +0000 Received: from mail-gh0-f175.google.com ([209.85.160.175]) (using TLSv1) by na3sys009aob101.postini.com ([74.125.148.12]) with SMTP ID DSNKUARitDxTxByLvd0i3foMV5YI6DaU2PVl@postini.com; Mon, 16 Jul 2012 11:51:33 PDT Received: by ghbz2 with SMTP id z2so5524045ghb.20 for ; Mon, 16 Jul 2012 11:51:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:x-gm-message-state; bh=ckhwpI1tk/bs2BTOqRtMUo7UJ764vJ2jz84S7m1dlz4=; b=ODR8l6kvc+UiUIkHi3JFtEAj0UdCwAbhrFvTGQ0XzFIh2j18azBlwKaFp/2AtlSbSL sBoBKeVBBYpUzF2QaZHHwI4TlQmDeMPQ5Lf+gSJ4z234kGooWpx6acdvJ98SWALM8Q+j SEUafm6PiOpTJZLNxLGDzYiCqMsbs4O75Gbgt6VJriIqSf7twKvQS8i/A/QwmIGEtfJD N+CgW0ecpR3yAOb+6Q76m0RrNUnES6p5nUNvF5ihm9W7388FpwPWF79drR1bcSediFDJ yBPpdmF7SKKWDVAILBMmlsUmJZzJO6+Ic8CF9V1bNissvJ8PkFCqD8lHCl5UjzsOrr1t 0QTg== Received: by 10.236.87.194 with SMTP id y42mr10322832yhe.81.1342464691818; Mon, 16 Jul 2012 11:51:31 -0700 (PDT) Received: from [10.210.165.247] ([190.216.51.2]) by mx.google.com with ESMTPS id z3sm14895112anj.17.2012.07.16.11.51.30 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jul 2012 11:51:31 -0700 (PDT) Message-ID: <500462B0.9010904@globant.com> Date: Mon, 16 Jul 2012 15:51:28 -0300 From: Victor Giordano User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: dev@jackrabbit.apache.org Subject: Search by an inputstream property Content-Type: multipart/alternative; boundary="------------010906050201030306070102" X-Gm-Message-State: ALoCoQnFotUXOtK8mEm1nv1ER6aBlpqisZ/ena2pjXnsmkA1x1ME443wq3g+VWvFXDwxOUeIZNFJ This is a multi-part message in MIME format. --------------010906050201030306070102 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi friends, i have a question about making a xpath expression for filtering resources by a property of type inputStream called data. How i can do a text search... for example... this is working: String xpath1 = "//element(*, nt:resource) [jcr:contains(@jcr:mimeType,'*plain*')]"; String xpath2 = "//element(*, nt:resource) [jcr:contains(@jcr:encoding,'*utf*')]"; But this is not working.... String xpath3 = "//element(*, nt:resource) [jcr:contains(@jcr:data,'*plain*')]"; The really fact is that we use some custom nodes.. let's explain the properties definitions: In Java Terms... |public class*Resource*extends BaseNode { || /** Encoding media type. It cannot be null or empty. */ @Field(jcrName = "jcr:encoding", jcrDefaultValue = "") private String encoding;| | /** Resource's MIME type. It cannot be null or empty. */ @Field(jcrName="jcr:mimeType", jcrDefaultValue = "") private String mimeType; /** Resource's size (bytes). */ @Field(jcrName="skl:size") private long size; /** Resource's content data as stream. It cannot be null. */ @Field(jcrName="jcr:data") private InputStream data; ... } ||@Node(jcrType = "baseNode", isAbstract = true) public abstract class*BaseNode*{ @Field(jcrName = "name", id = true) protected String name; @Field(jcrName = "creationDate") protected Date creationDate; ... }| And in JackRabbit Terms... nt:hierarchyNode docs:baseNode docs:baseNode *nt:resource* The point is.. how i do this query... in order to filter by jcr:data property... Thanks for advance, and for reading this! Greetings. Victor. --------------010906050201030306070102 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi friends, i have a question about making a xpath expression for filtering resources by a property of type inputStream called data.
How i can do a text search... for example... this is working:

String xpath1 = "<my app path>//element(*, nt:resource) [jcr:contains(@jcr:mimeType,'*plain*')]";
String xpath2 = "<my app path>//element(*, nt:resource) [jcr:contains(@jcr:encoding,'*utf*')]";

But this is not working....
String xpath3 = "<my app path>//element(*, nt:resource) [jcr:contains(@jcr:data,'*plain*')]";

The really fact is that we use some custom nodes.. let's explain the properties definitions:

In Java Terms...
public class Resource extends BaseNode {

  /** Encoding media type. It cannot be null or empty. */
  @Field(jcrName = "jcr:encoding", jcrDefaultValue = "")
  private String encoding;

  /** Resource's MIME type. It cannot be null or empty. */
  @Field(jcrName="jcr:mimeType", jcrDefaultValue = "")
  private String mimeType;

  /** Resource's size (bytes). */
  @Field(jcrName="skl:size")
  private long size;

  /** Resource's content data as stream. It cannot be null. */
  @Field(jcrName="jcr:data")
  private InputStream data;

  ...
}

@Node(jcrType = "baseNode", isAbstract = true)
public abstract class BaseNode {

  @Field(jcrName = "name", id = true)
  protected String name;

  @Field(jcrName = "creationDate")
  protected Date creationDate;

  ...
}

And in JackRabbit Terms...


<!-- Base node type definition -->
  <nodeType name="docs:baseNode"
            isMixin="false"
            hasOrderableChildNodes="false" >
    <supertypes>
      <supertype>nt:hierarchyNode</supertype>
    </supertypes>
    <propertyDefinition name="docs:name"
                        requiredType="String"
                        autoCreated="false"
                        mandatory="true"
                        onParentVersion="COPY"
                        protected="false"
                        multiple="false" />
    <propertyDefinition name="docs:searchPath"
                        requiredType="String"
                        autoCreated="false"
                        mandatory="false"
                        onParentVersion="COPY"
                        protected="false"
                        multiple="false" />
    <propertyDefinition name="docs:creationDate"
                        requiredType="Date"
                        autoCreated="false"
                        mandatory="true"
                        onParentVersion="COPY"
                        protected="false"
                        multiple="false" />
    <propertyDefinition name="docs:lastModified"
                        requiredType="Date"
                        autoCreated="false"
                        mandatory="true"
                        onParentVersion="COPY"
                        protected="false"
                        multiple="false" />
    <childNodeDefinition name="*"
                         defaultPrimaryType="docs:baseNode"
                         autoCreated="false"
                         mandatory="false"
                         onParentVersion="COPY"
                         protected="false"
                         sameNameSiblings="false">
      <requiredPrimaryTypes>
        <requiredPrimaryType>docs:baseNode</requiredPrimaryType>
      </requiredPrimaryTypes>
    </childNodeDefinition>
  </nodeType>


  <!-- Resource node type definition -->
  <nodeType name="skl:resource"
            isMixin="false"
            hasOrderableChildNodes="false" >
    <supertypes>
      <supertype>docs:baseNode</supertype>
      <supertype>nt:resource</supertype>
    </supertypes>
    <propertyDefinition name="skl:size"
                        requiredType="Long"
                        autoCreated="false"
                        mandatory="true"
                        onParentVersion="COPY"
                        protected="false"
                        multiple="false" />
    <propertyDefinition name="skl:externalUri"
                        requiredType="String"
                        autoCreated="false"
                        mandatory="false"
                        onParentVersion="COPY"
                        protected="false"
                        multiple="false" />
  </nodeType>

The point is.. how i do this query... in order to filter by jcr:data property...
Thanks for advance, and for reading this!
Greetings.
Victor.

--------------010906050201030306070102--