Hi Jack, see my comments inline.
On Tue, Jul 5, 2011 at 9:34 PM, Jack Kirsten <[email protected]> wrote: > Hi, I'm relatively new to Jackrabbit. In our application we never turned on > SearchIndex section within repository.xml (so as workspace.xml) files > because we always go directly to a given document using the JCR UUID > reference. By the way we use *Jackrabbit v2.2.1* and *Oracle* as the > repository. Now our requirements are getting expanded as we would like to > use the document metadata feature to store contextual info about a document > so that we can use the metadata to retrieve a selected set of documents. > > As the first step, I added the default SearchIndex section in workspace.xml > file and restarted the JCR. > > I saw a bunch of lines like this in my log file - then I saw it created the > *index* folder under workspace area. > > *2011-07-05 15:04:01.724 INFO [WebContainer : 0] MultiIndex.java:1204 > indexing... > /vfs:metaData/21ee130e-978e-415f-bfd1-7aa03d91608c/vfs:attributes (3500)* > > I have the folder structure like this. When I create a document in JCR, I > specify the metadata info as part of the document which is by a complex XSD > type with tags like docType, uploadedBy, contextValue, etc. > > / (root) > /MyApp (sub-folder) > /documents/ (sub-folder) > /document-1.pdf (file) > /document-2.pdf (file) > /accounts/ (sub-folder) > /account.txt (file) > etc... > > The following XPath expression works. > > *//jcr:root/vfs:metaData//*[vfs:attributes/vfs:docType='TAX_DOCS']* > > If I give wrong value, for example instead of 'TAX_DOCS', 'TAX', it returns > no documents as expected which is great. This proves that the metadata is > correctly stored as expected and it is used in the filter process correctly. > > The problem with this query is that it starts searching from the root folder > but I want to search from /MyApp/documents sub-folder only. So I tried > this: > > *//jcr:root/MyApp/documents//vfs:metaData//*[vfs:attributes/vfs:docType='TAX_DOCS']* > > It returns nothing. Then I tried this too but no success. > > *//jcr:root/MyApp/documents//*[vfs:metaData/vfs:attributes/vfs:docType='TAX_DOCS']* Maybe you could try: MyApp/documents//*[vfs:metaData/vfs:attributes/vfs:docType='TAX_DOCS']* I don't think you need to use the *//jcr:root . It should be fine that it's a relative location. > > So what am I doing wrong? Is anything in workspace.xml configuration that > we need to set or missing? No as far as I know it's not necessary to do that. You should be able to just use a query. > > Any help is appreciated. > > Thanks, Jack > > -- > View this message in context: > http://jackrabbit.510166.n4.nabble.com/Strange-XPath-Issue-tp3646893p3646893.html > Sent from the Jackrabbit - Users mailing list archive at Nabble.com. >
