You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by "Andrea K." <ak...@alteanet.it> on 2007/02/01 09:57:08 UTC

Binary Search

Hi,
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?

thanks again.

Andrea.
-- 
View this message in context: http://www.nabble.com/Binary-Search-tf3153666.html#a8744925
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Binary Search

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 2/1/07, Andrea K. <ak...@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);
    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