Expand my Community achievements bar.

SOLVED

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

Avatar

Level 9

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?

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@TB3dock , JCR Property type ('type'). Can be one of DateBooleanDouble , StringLong, 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

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@TB3dock , JCR Property type ('type'). Can be one of DateBooleanDouble , StringLong, 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