Quantcast
Channel: Optimizely Search & Navigation
Viewing all 6894 articles
Browse latest View live

Epi-Find: TermsFacet for counts inaccurate when corresponding filter is applied

$
0
0

I have the following facet on my Epi Find query.

public void ApplyManufacturerFacet()
{
    this.EpiFindSearch = this.EpiFindSearch.TermsFacetFor(r => r.ManufacturerId);
}


I am using the facet terms to retrieve counts for various filters that could be applied. I apply the filter with the following:

public void SearchByManufacturer(List<string> manufacturers)
{
    var catalogBuilder = this.EpiFindSearch.Client.BuildFilter<SiteProductVariation>();
    foreach (var manufacturer in manufacturers)
    {
        catalogBuilder = catalogBuilder.And(r => r.ManufacturerId.Match(manufacturer));
    }
    this.EpiFindSearch = this.EpiFindSearch.Filter(catalogBuilder);
}


When certain filters are applied, the number of results that are actually returned does not match the number that was returned by my request for the facet count. Here is the calling code for these functions. You can see that the filter is applied first, then the request for the facets is made.

...
if (manufacturers.Count > 0)
{
    search.SearchByManufacturer(manufacturers);
}
this.search.ApplyManufacturerFacet();
...


Secured Content in Index

$
0
0

I can see that unified search automatically trims out results that the current user does not have access to -- but the REST and Javascript API's do not.  If our client has a requirement that even the metadata cannot ever be discoverable by less-priveleged users, is it possible to secure index items within the elastic index so that even the public api's do not return content that users are not priveleged enough to view?

Unwanted synonyms in EPiServer Find

$
0
0

We have detected some words are registered as synonyms without us adding them manually. One example is "rus" (Norwegian for "intoxication") and "fyll" (Norwegian for binge drinking and "fill" as in "fill in the form").

Is this documented anywhere, and how do we get rid of it?

Catalog content is ignoring the Find Id I have given it

$
0
0

I am indexing products and categories in Find and using an initialisation module to set the client conventions - see below.

[InitializableModule]
    [ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
    public class SearchIndexInitialization : IInitializableModule
    {
        public void Initialize(InitializationEngine context)
        {           
            ContentIndexer.Instance.Conventions.ForInstancesOf<ImageFile>().ShouldIndex(x => false);
            SearchClient.Instance.Conventions.ForInstancesOf<BaseProduct>()
                .IdIs(x => x.Barcode)
                .IncludeField(x => x.InStock())
                .IncludeField(x => x.DisplayPrice());               
            SearchClient.Instance.Conventions.ForInstancesOf<BookProduct>()
                .IdIs(x => x.Barcode);
            SearchClient.Instance.Conventions.ForInstancesOf<GenericProduct>()
                .IdIs(x => x.Barcode);
            SearchClient.Instance.Conventions.ForInstancesOf<Magazine>()
                .IdIs(x => x.Barcode);
            SearchClient.Instance.Conventions.ForInstancesOf<AxNode>()
                .IdIs(x => x.Code);           
        }

However, the ID field of Barcode and Code for Nodes does not seem to be used. When I run any queries the ID still looks something like this: "CatalogContent_93c105e2-8ed7-413f-b188-450cf3ad9f14_en-US"

Note that BaseProduct is the inherited type of other products and included fields do work. I added the other derived types explicitly just in case it was an inheritance issue but that seems to have no effect.

Is the standard behaviour, a bug or I missing something?

Commerce product seach: using nodes/categories in facets

$
0
0

Hi,

I'm doing a product search for Episerver Commerce site using Find.

Most of the examples and the documentation use the products properties for faceting and filtering the search, but in our case we would like to filter by the all parent catalog nodes/categories the product has. 

What is the suggested way to accomplish this? Should I create a complex object and index those to Find, or is there another more straightforward way?

Br,
Keijo

Problems indexing commerce meta fields

$
0
0

Hi,

I am trying to install Find on a commerce solution. Everything is working great beside that the meta fields in products is not indexed just Name, publich date and so on.

Am i missing something?

Blocks and Pages has no problem being indexed.

Different number of search results

$
0
0

When we search for multiple types in one call we get for example 500 results 

 ITypeSearch<ISearchContent> unifiedSearch = SearchClient.Instance.UnifiedSearchFor(query).UsingSynonyms();

unifiedSearchResults = unifiedSearch.Skip(((page - 1) * hitsPerPage) * (hitsPerPage)).Take(hitsPerPage).FilterByExactTypes(new[] {
typeof(DocumentOrderPage), typeof(DocumentPage), typeof(VirtualDocumentPage), typeof(SiteMediaData),
typeof(LinkPage), typeof(EServiceStartPage), typeof(OperationInfoPage), typeof(NewsPage),
typeof(TopicPage), typeof(ListPage), typeof(CaretypePage), typeof(AidPage), typeof(NeedStaircasePage), typeof(NeedStepPage)}).ApplyBestBets().WildCardQuery("*" + query + "*", x => x.SearchText).Track().GetResult();

and when we divide search in three calls then we get more results. Depending on search word difference can be between few hundred and few thousand results. We would like to use only one call since it is much easier to represent results in pages but it looks that it is not working well. What should we change in code to get the same number of results in first call?


unifiedSearchResults = unifiedSearch.Skip((page - 1) * hitsPerPage).Take(hitsPerPage).FilterByExactTypes(new[] { typeof(NewsPage) }).ApplyBestBets().Track().GetResult();
returnValue.TotalResults = unifiedSearchResults.TotalMatching;


unifiedSearchResults = unifiedSearch.Skip((page - 1) * hitsPerPage).Take(hitsPerPage).FilterByExactTypes(new[] { typeof(DocumentOrderPage), typeof(DocumentPage), typeof(VirtualDocumentPage), typeof(SiteMediaData) }).ApplyBestBets().Track().GetResult();
returnValue.TotalResults = unifiedSearchResults.TotalMatching;

unifiedSearchResults = unifiedSearch.Skip((page - 1) * hitsPerPage).Take(hitsPerPage).FilterByExactTypes(new[] { typeof(LinkPage), typeof(EServiceStartPage), typeof(OperationInfoPage),
typeof(TopicPage), typeof(ListPage), typeof(CaretypePage), typeof(AidPage), typeof(NeedStaircasePage), typeof(NeedStepPage) }).ApplyBestBets().Track().GetResult();
returnValue.TotalResults = unifiedSearchResults.TotalMatching;

Exclude MediaData results from unpublished pages

$
0
0

Hello, I'm trying to search for MediaData that only exists on published pages. The pages can have many different kind of block areas with MediaData inside them. The requirement is that the MediaData itself does not have to be unpublished, only its parent page where it exists. My search query looks as follows

var FileQuery = SearchClient.Instance.Search<MediaData>()
                    .For(model.Query)
                    .WildCardQuery(wildtext, x => x.Name)
                    .CurrentlyPublished()
                    .PublishedInCurrentLanguage()
                    .FilterForVisitor()
                    .FilterOnReadAccess()
                    .Track()
                    .Take(model.FilesMaxResults);

This gives me hits from all assets folders.

Then I'm trying to see if the link have soft link, if that is the case get OwnerContentLink.

var contentResultFileHits = FileQuery.GetContentResult();
                var repository = ServiceLocator.Current.GetInstance<IContentLoader>();
                    var linkRepository = ServiceLocator.Current.GetInstance<IContentSoftLinkRepository>();
                    var fileHits = contentResultFileHits
                        .Select(x => x)
                        .Where(x => linkRepository.Load(x.ContentLink, true)
                            .Where(link => link.SoftLinkType == ReferenceType.PageLinkReference && !ContentReference.IsNullOrEmpty(link.OwnerContentLink))
                                .Select(link => link.OwnerContentLink)
                                .Any(o => CheckPublished(repository, o)));

After that, check if the ContentReference is PageData, if so check start publish date, stop publish date and deleted. Otherwise call method again with parent link.

private static bool CheckPublished(IContentLoader repository, ContentReference o)
        {
            var content = repository.Get<IContent>(o);
            try
            {
                var bb = (((PageData)content).StopPublish == null || ((PageData)content).StopPublish > DateTime.Now && ((PageData)content).StartPublish < DateTime.Now) && !content.IsDeleted;
                return bb;
            }
            catch (InvalidCastException)
            {
                return CheckPublished(repository, content.ParentLink);
            }
        }

This doesn't seem to work very well on blocks as the parent link for the block container doesn't reference the page. How can I improve my search query to get required result?

 
   


Unified search just search in one field

$
0
0

Hi,

We are using unified-search in one of our projects and in one specifc case I would like to search in just one field.
At the moment we have the following code which seems to search in more than just the one field.

_client.UnifiedSearch().For(search.Search).InField(x => x.SearchAuthors)

How can I search in just one field using unified-search?


Thanks in advance.

Regards,

Robert Baarda

.InField with string argument

$
0
0

Hi!

I'm trying to use method InField with a string argument, but it doesn't seem to work.

            return client.Search<ProductPage>()
                .For(searchQuery)
                .InField(i => i.FullName)
                .GetPagesResult(); // returns results
            return client.Search<ProductPage>()
                .For(searchQuery)
                .InField("FullName")
                .GetPagesResult(); // doesn't return any result

What can be the problem?

.InField with string argument

$
0
0

Hi!

I'm trying to use method InField with a string argument, but it doesn't seem to work.

            return client.Search<ProductPage>()
                .For(searchQuery)
                .InField(i => i.FullName)
                .GetPagesResult(); // returns results
            return client.Search<ProductPage>()
                .For(searchQuery)
                .InField("FullName")
                .GetPagesResult(); // doesn't return any result

What can be the problem?

Sort by relevancy and then by other field

$
0
0

I have an issue with sorting in Find. I have a requirement that products in the search results should be sorted by relevancy and then by bought count. I am calculating bought count in a separate scheduled job and updating the field on the product content, so it is available for Find.

When I apply OrderBy on the bought count property, then relevancy is completely ignored. I found this thread: https://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=80937 where a custom extension method was used to force search by relevancy: https://gist.github.com/lindstromhenrik/9779858. I have tried it by ordering by score first and then by my bought count field:

search = search
    .OrderByScore()
    .ThenByDescending(x => x.BoughtCount);

Now relevancy sorting works, but sorting by bought count doesn't work anymore. If I understand correctly the reason is that sorting by score is too granular for my case. Is there a way to have 

Is there a way to fix this? It would be good if I could access the score, then I could create my own sorting "score".

Which CMS? EPiServer or Plone?

$
0
0

I want to go for a CMS, but there are loads and i'm confused which one to go for. I kind of did some research and filtered 2 CMS, one is episerver cms http://www.episervercms.com , and the other is plone(plone.com)? any idea or suggestions?

UsingAutoBoost removes any entries with _hit_count > 1

$
0
0

Hi,

I am using EPiServer Find to Boost the results. I want to bring back results on top whose hit counts are greater.

I have seen any page which has got hit count greater than 0 does not come back in query if i add UsingAutoBoost

Does anyone had similar issue?

Any help would be appreicated.

Cheers

Epi Find GetResults doesn't return anything if filterForPublicSearch = true

$
0
0
I am trying to get only hits that everyone group has access to (public) but can't seem to get it working. If i use filterForPublicSearch = false it works fine.

below is from the indexed content json:


"RolesWithReadAccess$$string": ["Everyone","Read only",
      ]



I am using the same code that EPiServer vs pluging created.

PS: I made whole site public on my dev machine but still the same issue.

Find demo site is down

How to return assigned Category to a page with Epi Find results

$
0
0

Hi Epi Devs,

Wondering how you set up the search so that it returns the category of the page that's been index and return in search? 

I can see in the indexed JSON that the category is there.

Stemming not working for one of two indexes

$
0
0

I have a strange problem. I have two indexes. One that I use from the dev environment and one that is used from the test server. Both indexes are installed on the same raw Episerver Find server. The version is Find .NET API Version: 12.5.3.0.

Both indexes is set up with Norwegian and English language.

The two indexes uses different databases, but I have created the "exact same" page in both solutions. Both indexes index the same content, and only som id's and dates are different (checked with Beyond Compare).

To the problem: When I search for "vinter" in the dev index (in the find gui itself) it returns a hit on "vinterfest". When I do the same in the test environment I get zero result.

Both indexes returns the correct hit when I search for "vinterfest".

So I cant understand why one of the indexes works with stemming and one don't. It's no special settings done via the find gui in any of them, and it's not my code doing this since i search via the Find GUI. 

I have no idea where to look further, any tips?

/Andreas

AutoBoost and the "Age" property used in Decay?

$
0
0

In the documentation for AutoBoosting (http://world.episerver.com/documentation/developer-guides/find/NET-Client-API/searching/auto-boosting/) it states that a document is Decayed using the Age of the document.

"Normally, the date value is the document age or updated date value, and the fixed point in time is the search time."

My question here is, since the whole feature of Decay is based on this value, what actual property of the Content is read? Is it the SavedDate, or ChangeDate or CreatedDate? Or even PublishedDate?

In our solution we have a custom Content object that implements the two IContent, IChangeTrackable and currently I am setting the "CreatedDate" but not seeing any difference in scoreing. Do I also need to .Track() when using decay? Or do I need to implement and set some other interface on my custom indexed object?

Can I pass a reflected property into a TermsFacetFor method?

$
0
0

I am working on a search feature that adds different search facets to the search page depending on where the user is searching in a product catalog.  For example, if the user is searching over all products, the user might want to filter by manufacturer.  But if the user is searching the products of just a single manufacturer, they don't need a manufacturer filter and might want to filter by brand instead.

To try to reuse code and not write dozens of functions for all possible filters, I have created a generic function to get facets for each filter:

		public Dictionary<string, int> GetFilterCounts(IContentResult<SiteProductVariation> results, Expression<Func<SiteProductVariation, object>> fieldSelector)
		{
			Dictionary<string, int> facetResults = new Dictionary<string, int>();
			var facetItems = results.TermsFacetFor(fieldSelector);
			foreach (var item in facetItems)
			{
				facetResults.Add(item.Term.Replace('-', ''), item.Count);
			}
			return facetResults;
		}

However, the facets for each starting catalog node are stored as a list of strings on the node content.  To get from the string property name to the fieldSelector that the TermsFacetFor function needs I am trying to use System.Reflection but I cannot find a way to make it get the property in a way that TermsFacetFor can use.  Here is a list of what I've tried:

			var facetResult = search.GetFilterCounts(dataList, s => s.GetType().GetProperty(facet.Name).GetGetMethod());
			var facetResult = search.GetFilterCounts(dataList, s => s.GetType().GetProperty(facet.Name));

Both of these have resulted in null being returned from the TermsFacetFor call.  Is what I'm trying even possible?  If so, how can I manage it?

Viewing all 6894 articles
Browse latest View live