Getting Synonyms working

Vote:
 

Been trying to get synonyms working. But when I add it to my query I just get empty results back. Code is as follows. (with out the UsingSynonyms() everything works fine)

var query = searchInstance.Search<BasePageData>(Language.Swedish)
                    .For(args.Query)
                    .UsingSynonyms()
                    .FilterForVisitor();
					
query = query.Filter(x => !x.Ancestors().Match(currentPage.StartPage.ArchivePage.ID.ToString()));

// Add filter for SearchType
if (!string.IsNullOrEmpty(args.SearchType))
	query = query.Filter(x => x.SearchTypeName.Match(args.SearchType));

// Add filter for SiteId
query = query.Filter(x => x.SiteId().Match(args.SiteId));

// Setting up paging
if (string.IsNullOrEmpty(args.Pagnation))
	currentPage.PagingPage = 1;
else
	currentPage.PagingPage = Convert.ToInt16(args.Pagnation);

var searchHitQuery = AddProjection(jobsearchpageUrl, query, 200)
								.Skip((currentPage.PagingPage - 1) * currentPage.HitsToShow)
								.Take(currentPage.HitsToShow)
								.ApplyBestBets()
								.Track(); 
								
currentPage.Results = searchHitQuery.GetResult();
										
										
										
private ISearch<SearchHit> AddProjection(string jobsearchpageUrl, ITypeSearch<BasePageData> query, int searchTextLength)
{
	return query.Select(x => new SearchHit
							{
								Title = x.Name,
								Text = x.SearchText().AsCropped(searchTextLength),
								Url = x.LinkURL,
								PublishedDate = x.StartPublish,
								SearchType = x.SearchTypeName,
								SiteId = x.SiteId()
							})
							.IncludeType<SearchHit, Assignment>(x => new SearchHit
							{
								Title = x.Localization.AssignmentLoc.AssignmentTitle,
								Url = jobsearchpageUrl,
								AssignmentUrl = string.Format("id/?assign={0}", x.Guid),
								PublishedDate = x.PublishStartDate,
								SearchType = x.SearchTypeName,
								SiteId = x.SiteId
							})
							.IncludeType<SearchHit, MediaData>(x => new SearchHit
							{
								Title = x.Name,
								Url = UrlResolver.Current.GetUrl(x.ContentLink),
								PublishedDate = (DateTime)x.SearchPublishDate(),
								FileExtention = x.SearchFileExtension(),
								SearchType = GetListItemType(x.SearchFileExtension()),
								SiteId = x.SiteId()
							})
							.IncludeType<SearchHit, EPiServer.Find.Framework.WebContent>(x => new SearchHit
							{
								Title = x.SearchTitle,
								Url = x.SearchHitUrl,
								Text = x.SearchText.AsCropped(searchTextLength),
								PublishedDate = new DateTime(),
								SearchType = GetWebContentType()
							});
}

Anyone seening my mistake?

#87932
Jun 25, 2014 18:27
Vote:
 
#143980
Feb 04, 2016 10:00
Vote:
 

Try specifying .InField() -  .InField(x => x.SearchText()) and .InField(x => x.SearchTitle()) for instance.

Is this index hosted in an on premise solution?

#144002
Feb 04, 2016 12:28
* 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.