Hello @Abhishek,
Take a look at these previous forum posts:
Forum post #1 - This post explains how to include properties into the index by creating an initialization module.
Forum post #2 - This post explains how to return the data that's included in the index.
Hope this helps!
-RJ
Hi RJ,
Thanks for the reply. I doesn't got the hits after applying suggested solution.
First I have created the follwoing Extn method to refernce "BrandName" property.
public static IEnumerable<string> ReferenceBrands<T>(this T content)
{
var file = content as IContent;
//if (file != null)
//{
var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
var references = contentRepository.GetReferencesToContent(file.ContentLink, false);
foreach (var referenceInformation in references)
{
PageData page = null;
contentRepository.TryGet(referenceInformation.OwnerID, out page);
if (page != null)
yield return page.GetPropertyValue("BrandName");
}
//}
}
After that include it in index : SearchClient.Instance.Conventions.ForInstancesOf<PageData>().IncludeField(x => x.ReferenceBrands());
Build Index.
Update by query as :
var queryFor = searchClient.UnifiedSearch().For(model.Query);
if (model.UseAndForMultipleSearchTerms)
{
queryFor = queryFor.WithAndAsDefaultOperator();
}
var query = queryFor
.UsingSynonyms()
.UsingAutoBoost(TimeSpan.FromDays(30))
.Filter(x=>x.ReferenceBrands().Match("Manpower"))
.TermsFacetFor(x => x.ReferenceBrands())
.FilterFacet("AllSections", x => x.ReferenceBrands().Exists())
.Skip((model.PagingPage - 1) * model.CurrentPage.PageSize)
.Take(model.CurrentPage.PageSize)
.ApplyBestBets();
PLease suggest.
Thanks
Abhishek
Hi
I have implimented the serach page by taking reference from Aloy site. It is unified search result. Now I have to filter the current result by Property Values BrandName and PublishDate.
Please suggect me asap.
Thanks
Abhishek