We are using OOTB lucene to index the pages and properties. We have a requirement to exclude paths from search index dynamically. i.e the list of paths are not fixed and does not fall under a particular folder. The author should have an option to exclude any page from search at any moment. Due to this, the option to use excludePaths in the index node is not feasible.
We have introduced a property 'excludeinSearch' in page properties and restricting the search results by querying based on this property value. But the same doesn't work for Suggestions. Is there any way to customize the suggestions based on a property in page?
I believe it is difficult to restrict during the query time. Because the below query doesn't yield any result and it doesn't make sense. Because the suggestion dictionary might not be aware of the property.
SELECT [rep:suggest()] as suggestion FROM [cq:Page] as s WHERE ISDESCENDANTNODE(s, '/content/project/') AND suggest('test') AND s.excludeinSearch=false.
Can we make any customization to ignore the pages with this property from lucene index during reindexing time?