How to add an index for a property which is an array? | Community
Skip to main content
Level 8
May 18, 2023 4:31 PM UTC
Solved

How to add an index for a property which is an array?

If you have basic string properties on your page, you can add indexes like this:

 

<indexRules jcr:primaryType="nt:unstructured">
<cq:PageContent jcr:primaryType="nt:unstructured">
<properties jcr:primaryType="nt:unstructured">
<bonusId
jcr:primaryType="nt:unstructured"
name="bonusId"
propertyIndex="{Boolean}true"
type="String"/>

The problem is when you have a page property which is an array of strings.  How does one create an index for this?  What is "type" in this case?

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
ShubhanshuSi2Accepted solution
New Participant
May 19, 2023 7:10 AM UTC

@tb3dock , JCR Property type ('type'). Can be one of Date, Boolean, Double , String, Long, or Binary. All the values in String[] for that property are extracted by the indexing engine. This enables you to search the resource by a specific value in the array of values for that property. The only think that matters here is property's data type here which is String.

You can view the indexed data of a resource/page/asset by directly hitting URL and appending .index.data.json.

Documentation: https://jackrabbit.apache.org/oak/docs/query/lucene.html#property-definitions

1 reply

ShubhanshuSi2Accepted solution
New Participant
May 19, 2023 7:10 AM UTC

@tb3dock , JCR Property type ('type'). Can be one of Date, Boolean, Double , String, Long, or Binary. All the values in String[] for that property are extracted by the indexing engine. This enables you to search the resource by a specific value in the array of values for that property. The only think that matters here is property's data type here which is String.

You can view the indexed data of a resource/page/asset by directly hitting URL and appending .index.data.json.

Documentation: https://jackrabbit.apache.org/oak/docs/query/lucene.html#property-definitions

Translate