November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Add a property named SearchTitle to your content type and it will be used as title in the search result.
public virtual string SearchTitle { get { return Heading; } }
Cheers
Hi Marcus Lindblom,
Why I can't configure this in the configuration?
For example:
client.Conventions.ForInstancesOf<ArticlePage>() .IncludeField(p => p.SearchTitle());
Is it possible to change indexing behaviour without adding new field to the object?
You can configure this. Check out the unified search documentation:
http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/10/DotNET-Client-API/Searching/Unified-search/
Here is an example:
client.Conventions.UnifiedSearchRegistry .ForInstanceOf<MySearchableClass>() .ProjectTitleFrom(x => x.MyTitleProperty);
Hi,
I tried to do this but it doesn't work as expected.
Code:
[InitializableModule] [ModuleDependency(typeof(EPiServer.Web.InitializationModule))] public class SearchInitialization : IInitializableModule { public void Initialize(InitializationEngine context) { SearchClient.Instance.Conventions.UnifiedSearchRegistry .ForInstanceOf<ArticlePage>() .ProjectTitleFrom(p => p.Title); } public void Uninitialize(InitializationEngine context) { } }
or
var client = ServiceLocator.Current.GetInstance<IClient>(); client.Conventions.UnifiedSearchRegistry .ForInstanceOf<ArticlePage>() .ProjectTitleFrom(p => p.Title);
or
client.Conventions.UnifiedSearchRegistry .ForInstanceOf<ArticlePage>() .ProjectTitleFrom(p => p.SearchTitle());
doesn't work.
If I add 'SearchTitle' to ArticlePage it will change indexing behaviour.
Could you please help me to find error in my implementation?
Your first bulk of code looks correct. But remember that you will have to reindex your content after adding the conventions.
Always use SearchClient.Instance.
I did:
1) IClient was replaced by SearchClient.Instance;
2) Index was reindexed (I also created new develop index);
3) Different configuration was checked:
SearchClient.Instance.Conventions .ForInstancesOf<ArticlePage>() .IncludeField(p => p.SearchTitle());
It seems to me that this has no effect on indexing data. I uses EPiServer Find 9.6.0.3185
P.S. Why should I always use SearchClient.Instance?
SearchClient.Instance is preconfigured with default conventions for how different types (such as IContent) should be serialized.
I'm not sure why it is not working for you. However, I would do as Marcus suggested earlier in the thread, and just add a new property to your page that is named SearchTitle. Quick and easy.
Hi,
We have page:
Result from UnifiedSearch contains page Name property value in the Title property. (EPiServer.Find.UnifiedSearch.UnifiedSearchHit.Title)
Is it possible to change this behaviour to the specific type? It is important because Title has different weight in the search configuration.
Best regards,
Pavel