Hi,

On 2/1/07, Andrea K. <[EMAIL PROTECTED]> 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);
   file.save();

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.

BR,

Jukka Zitting

Reply via email to