EPiServer.Search.Queries.Lucene.VirtualPathQuery stops to work if VirtualPathNodes count > 6



We use EpiServer.CMS - 11.10.6, EPiServer.Search - 9.0.1.

Customer asked us to implement contextual search (depends on the selected folder) in CMS Page Navigation tree and Assets Panel search boxes. We supported it from the client side but faced with an issue of PageSearchProvider, FileSearchProvider and BlockSearchProvider.

Search(Query query) method returns no results if query.SearchRoots contains a node which is deeper than 6 level:

            if (ContentReference.TryParse(query.SearchRoots.ToList().FirstOrDefault(), out ContentReference reference2))


                var paths = ContentSearchHandler.GetVirtualPathNodes(reference2);

                if (paths.Count > 6)

                    SearchProvider.Search(query); ==================> No Results



We’ve investigated this behaviour and found that VirtualPathQuery stops to work if VirtualPathNodes count  > 6.

For example:

EPISERVER_SEARCH_VIRTUALPATH:(43f936c9\-9b23\-4ea3\-97b2\-61c538ad07c9|e56f85d0\-e833\-4e02\-976a\-2d11fe4d598c|0b5aa5ef\-257d\-47be\-ab4a\-d085a5211948|a1aaa87f\-cb7a\-4285\-80ac\-a08ef4df5f66|057d00af\-2834\-4866\-9f7d\-327e9a928fa3|755eab30\-dfbb\-44be\-b4ff\-752467b1a4d9*) -> returns correct results

EPISERVER_SEARCH_VIRTUALPATH:(43f936c9\-9b23\-4ea3\-97b2\-61c538ad07c9|e56f85d0\-e833\-4e02\-976a\-2d11fe4d598c|0b5aa5ef\-257d\-47be\-ab4a\-d085a5211948|a1aaa87f\-cb7a\-4285\-80ac\-a08ef4df5f66|057d00af\-2834\-4866\-9f7d\-327e9a928fa3|755eab30\-dfbb\-44be\-b4ff\-752467b1a4d9|d39ee414\-e083\-4650\-a33e\-c2128423601c*)  -> no results

As a workaround we can implement custom SearchProviders with another implementation of VirtualPathQuery but it requires to copy/paste a lot of code from EPiServerSearchProviderBase it is what we would like to avoid.

Would you please give us any advice or maybe we are missing anything?



Edited, Dec 11, 2018 11:11
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.