1

We have our custom node type "ns:Document" with property "ns:id". Is it possible to find node (ns:Document) by property (ns:id) when we increase document version and save new document content with new "ns:id"?

this xpath:

//element(*)[(@ns:id = 'someUniqueID')]

finds only actual version, not "frozenNode". Is it possible to find "frozenNode" by property?

Thanks in advance!

1 Answers1

0

You need to configure a repository-wide SearchIndex as well as a workspace SearchIndex. Do that by adding a SearchIndex element inside your repository element, in your repository config. Once you have done that, the search will automatically search on both the workspace and repository-wide search indexes.

You can search on frozen nodes with eg.

SELECT * FROM [nt:frozenNode] AS document WHERE ...

I've used JCR-SQL2 as you added it as a label :)

TedTrippin
  • 3,525
  • 5
  • 28
  • 46
  • Could you please elaborate how to add the `SearchIndex` element? Is it in the `repository.xml`? – Frakcool Jun 22 '17 at 13:28
  • This is what I have in my `repository.xml`: ` ` (I know it doesn't look nice in the comments). From [this page](https://wiki.magnolia-cms.com/display/WIKI/Jackrabbit+Repository+Configuration+File) I went to the `repository.xml` file and found it was already configured (I downloaded the standalone jackrabbit server) this `SearchIndex` tag is under the `Workspace` one – Frakcool Jun 22 '17 at 13:33
  • Check out the [jackrabbit docs](http://jackrabbit.apache.org/jcr/jackrabbit-configuration.html). – TedTrippin Jun 22 '17 at 13:46
  • Alright, from what I understand from the docs (and your answer), I need to have `SearchIndex` tag under both, `Workspace` and `Repository` tags, I have both of them already in the `repository.xml`, both having a similar structure as in my previous comment, changin only `wsp.home for `rep.home` and `/index` for `/repository/index` on the value property. If you have the time I'd highly appreciate your guidance. – Frakcool Jun 22 '17 at 14:03
  • What I'm trying to achieve is looking through the properties of versioned nodes (which I know are the frozen nodes) with a jcr sql2 query, maybe I miss understand the Q&A and this is a completely different question. – Frakcool Jun 22 '17 at 14:04