Mapping Searchable File

7 views
Skip to first unread message

Mato

unread,
Jan 19, 2011, 6:30:29 AM1/19/11
to jcrom
Hello,

in my application, I need to store binary content (pdf) and to be able
to search for it. I was trying to get the mapping with jcrom right for
this purpose but with no success. JcrFile doesn't suit my needs very
well, since I would like to store InputStream at one of my pojos.
My approach was to create a container class with node type nt:resource
with all the appropriate fields like jcr:data, jcr:mimeType:

@JcrNode(nodeType = "nt:resource")
public class Doc {

@JcrName String name = "doc";
@JcrPath String path;
@JcrProperty(name = "jcr:mimeType")private String mimeType;
@JcrProperty(name = "jcr:data")private InputStream data;
... setters and getters
}

and the parent class which holds this Doc:
public class Foo {

@JcrName private String name = "foo";
@JcrPath private String path;
@JcrUUID private String Id;
@JcrChildNode Doc doc;
...
}

everything works fine, it stores all the fields as set, but I cannot
search in the Doc. I was trying with:
Query q = qm.createQuery("//foo/doc[jcr:contains(., 'somthing')]",
Query.XPATH);
with no results.

Does anybody have some idea, or I'm I doing it competely wrong?

Thanks

Martin
Reply all
Reply to author
Forward
0 new messages