November Happy Hour will be moved to Thursday December 5th.

Get search result under specific page

Vote:
 

Hi,

Our search results must depend on what part of the tree is now user.

How should we configure search request to search under specific content reference?

Search result should includes root page (provided as content reference to request) and children pages.

Best regards,

Pavel

#140998
Nov 06, 2015 9:56
Vote:
 

Hi,

you could filter on ancestors:

.Filter(x => x.Ancestors().Match(somePage.ContentLink.ID)) 
#141001
Nov 06, 2015 10:29
Vote:
 

Or if you use UnifiedSearch you could/should use:

.Filter(x => !x.MatchTypeHierarchy(typeof(PageData))
                            | ((PageData)x).Ancestors().Match(somepage.PageLink.ToString()))
#141009
Nov 06, 2015 11:13
Vote:
 

Henrik Fransas I have several question according to your code:

1) Do you know where this code will be executed (EPiServer application OR EPiServer Find server)?

2) Is Filter always to be performed on the application side or search side?

3) I saw that 'Ancestors' property presents in the EPiServer Find index. 

Is it possible to add filter to search request by property name without type conversion? 

#141090
Nov 09, 2015 15:28
Vote:
 

1. EPiServer Find server

2. Search side

3. Don't worry about the type conversion. It will never actually be invoked, as the Find search query will only look at the Field Name, which is "Ancestors" in this case. This also means that the "Ancestors" method will only be invoked when you index the content, and never when running the query. When the query is run, it will look for a property with the same name (Ancestors) in the index.

#141091
Nov 09, 2015 15:32
Vote:
 

Thanks guys for your answers

#141105
Nov 10, 2015 6:28
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.