jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: Binary Search
Date Thu, 01 Feb 2007 17:57:43 GMT

On 2/1/07, Andrea K. <akregar@alteanet.it> wrote:
> what is the right way to save binary data (documents, etc..) in a node (es:
> setproperty("document", ...Stream..)) and integrate it in the fulltext
> search? It can be used in this way or fulltext search is working only on
> standalone nt:resources?

The easiest way is to use the nt:resource node type and fill in the
jcr:data and jcr:mimeType properties, like this:

    Node file = ...;
    InputStream data = ...;
    Node resource = file.addNode("jcr:content", "nt:resource");
    resource.setProperty("jcr:mimeType", "...");
    resource.setProperty("jcr:lastModified", Calendar.getInstance());
    resource.setProperty("jcr:data", data);

The use of the nt:resource node type is not strictly required, as
Jackrabbit currently indexes all "jcr:data" binary properties that
have a "jcr:mimeType" property on the same node.

I just filed two improvement requests, JCR-728 and JCR-729, for
enhancing Jackrabbit to index all binary properties based on
automatically detected MIME types.


Jukka Zitting

View raw message