title: Search by an inputstream property
body: <p>I have a question about making a xpath expression for filtering resources by a property of type <code>inputStream</code> called data.
  How can I do a text search, for example this is working:</p>
  
  <pre><code>String xpath1 = "&lt;my app path&gt;//element(*, nt:resource) [jcr:contains(@jcr:mimeType,'*plain*')]";
  String xpath2 = "&lt;my app path&gt;//element(*, nt:resource) [jcr:contains(@jcr:encoding,'*utf*')]";
  </code></pre>
  
  <p>But this is not working.</p>
  
  <pre><code>String xpath3 = "&lt;my app path&gt;//element(*, nt:resource) [jcr:contains(@jcr:data,'*plain*')]";
  </code></pre>
  
  <p>The really fact is that we use some custom nodes, let's explain the properties definitions:</p>
  
  <p><strong>In Java Terms...</strong></p>
  
  <pre><code>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;
  
    ...
  }
  </code></pre>
  
  <p><strong>And in JackRabbit Terms...</strong></p>
  
  <pre><code>&lt;!-- Base node type definition --&gt;
    &lt;nodeType name="docs:baseNode"
              isMixin="false"
              hasOrderableChildNodes="false" &gt;
      &lt;supertypes&gt;
        &lt;supertype&gt;nt:hierarchyNode&lt;/supertype&gt;
      &lt;/supertypes&gt;
      &lt;propertyDefinition name="docs:name"
                          requiredType="String"
                          autoCreated="false"
                          mandatory="true"
                          onParentVersion="COPY"
                          protected="false"
                          multiple="false" /&gt;
      &lt;propertyDefinition name="docs:searchPath"
                          requiredType="String"
                          autoCreated="false"
                          mandatory="false"
                          onParentVersion="COPY"
                          protected="false"
                          multiple="false" /&gt;
      &lt;propertyDefinition name="docs:creationDate"
                          requiredType="Date"
                          autoCreated="false"
                          mandatory="true"
                          onParentVersion="COPY"
                          protected="false"
                          multiple="false" /&gt;
      &lt;propertyDefinition name="docs:lastModified"
                          requiredType="Date"
                          autoCreated="false"
                          mandatory="true"
                          onParentVersion="COPY"
                          protected="false"
                          multiple="false" /&gt;
      &lt;childNodeDefinition name="*"
                           defaultPrimaryType="docs:baseNode"
                           autoCreated="false"
                           mandatory="false"
                           onParentVersion="COPY"
                           protected="false"
                           sameNameSiblings="false"&gt;
        &lt;requiredPrimaryTypes&gt;
          &lt;requiredPrimaryType&gt;docs:baseNode&lt;/requiredPrimaryType&gt;
        &lt;/requiredPrimaryTypes&gt;
      &lt;/childNodeDefinition&gt;
    &lt;/nodeType&gt;
  
  
    &lt;!-- Resource node type definition --&gt;
    &lt;nodeType name="skl:resource"
              isMixin="false"
              hasOrderableChildNodes="false" &gt;
      &lt;supertypes&gt;
        &lt;supertype&gt;docs:baseNode&lt;/supertype&gt;
        &lt;supertype&gt;nt:resource&lt;/supertype&gt;
      &lt;/supertypes&gt;
      &lt;propertyDefinition name="skl:size"
                          requiredType="Long"
                          autoCreated="false"
                          mandatory="true"
                          onParentVersion="COPY"
                          protected="false"
                          multiple="false" /&gt;
      &lt;propertyDefinition name="skl:externalUri"
                          requiredType="String"
                          autoCreated="false"
                          mandatory="false"
                          onParentVersion="COPY"
                          protected="false"
                          multiple="false" /&gt;
    &lt;/nodeType&gt;
  </code></pre>
  
  <p>The point is, how do I do this query in order to filter by the jcr:data property.</p>