Fulltext search index depth
I'm an trying to add fulltext search function using Lucene,
Issue is the depth of the fulltext search. Let me explain this through an example. Say you have to pages that contain a text component with the term "Foo" in the text and the search Predicate {fulltext=Foo, p.offset=0, p.limit=2, path=/content/mypath, type=cq:Page, p.excerpt=true}.
cq:Page Page 1
jcr:content
par1
component_text (search term "Foo" is here)
cq:Page Page 2
jcr:content
par1
component_wrapper
component_text (search term "Foo" is here)
The default index will find Page 1 but not Page 2.
I created a custom index increasing the number of aggregates for cq:Page (xml included below). That successfully returns Page 1 and Page 2, but it also returns all the parent pages in the tree.
Any suggestions how to resolve this?
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="oak:Unstructured"
async="async"
compatVersion="{Long}2"
name="myPageLucene"
reindex="{Boolean}false"
includedPaths="[/content/mypath]"
queryPaths="[/content/mypath]"
evaluatePathRestrictions="{Boolean}true"
reindexCount="{Long}1"
type="lucene">
<aggregates jcr:primaryType="nt:unstructured">
<cq:Page jcr:primaryType="nt:unstructured">
<include0
jcr:primaryType="nt:unstructured"
path="jcr:content"
relativeNode="{Boolean}false"/>
<include1
jcr:primaryType="nt:unstructured"
path="*/*/*"
relativeNode="{Boolean}false"/>
<include2
jcr:primaryType="nt:unstructured"
path="*/*/*/*"
relativeNode="{Boolean}false"/>
<include3
jcr:primaryType="nt:unstructured"
path="*/*/*/*/*"
relativeNode="{Boolean}false"/>
<include4
jcr:primaryType="nt:unstructured"
path="*/*/*/*/*/*"
relativeNode="{Boolean}false"/>
<include5
jcr:primaryType="nt:unstructured"
path="*/*/*/*/*/*/*"
relativeNode="{Boolean}false"/>
<include6
jcr:primaryType="nt:unstructured"
path="*/*/*/*/*/*/*/*"
relativeNode="{Boolean}false"/>
<include7
jcr:primaryType="nt:unstructured"
path="*/*/*/*/*/*/*/*/*"
relativeNode="{Boolean}false"/>
<include8
jcr:primaryType="nt:unstructured"
path="*/*/*/*/*/*/*/*/*/*"
relativeNode="{Boolean}false"/>
<include9
jcr:primaryType="nt:unstructured"
path="*/*/*/*/*/*/*/*/*/*/*"
relativeNode="{Boolean}false"/>
</cq:Page>
</aggregates>
<indexRules jcr:primaryType="nt:unstructured">
<cq:Page jcr:primaryType="nt:unstructured"/>
</indexRules>
</jcr:root>



