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

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

  • May 18, 2023
  • 1 reply
  • 790 views

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.
Best answer by ShubhanshuSi2

@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

1 reply

ShubhanshuSi2Community AdvisorAccepted solution
Community Advisor
May 19, 2023

@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