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

Decimal metafield using MetaFieldBuilder

$
0
0

Hi,

I'm trying to add a metafield to the cls_organization table, by using the MetaFieldBuilder. Now, creating most of the fields works fine, however, I am not able to create a decimal with a specific precision and scale. When I use the CreateDecimal method, a float is created, which is not what I want.

If I add en entry in the [mcmd_MetaFieldType], with name "Decimal" and MCDataType 18, and use the CreateMetaField method instead where I specify "Decimal" as the typeName and pass an AttributeCollection with specific Precision and Scale, it works fine.

What I am wondering is, is this a safe way to achieve the decimal column in the database?

Best regards
Jessica


Issue with Applying filter on null content

$
0
0

I have an EPI find query as below

multisearch = multisearch.Search<GenericPage, SearchHitResult>(s => s
.FilterForVisitor()
.Filter(f => !f.ContentLink.Match(ContentToFilter.ContentLink))
.Skip((page - 1) * pageSize)
.Take(pageSize)
.OrderByDescending(x => x.ArticleDate)

The ContentToFilter is a Page type which I get using content loader as shown below:

_contentLoader.TryGet<IContent>(optionalContent, out var ContentToFilter);

There is a possibility that TryGet will result in null and then the filter line will throw exception. How do I check for null content before applying this filter. 

episerver file upload in Form container not working

$
0
0

Hi, I've made a Form container with some text, text area, selection,...and File upload with limit to 20MB. When the form is published and I upload the file it seems okay but when I submit and receive the email confirming the submission which includes the #summary# the file uploaded is not there and when I check the form submissions I cannot find the uploaded file. Any advice?

After Updating Episerver to latest version - No owin.Environment item was found in the context.

$
0
0

Hi,

After upating the packages to the latest version and on hosting the solution in IIS Server, I am getting this error .

No owin.Environment item was found in the context.
When apicontrollers are hit from a different domain. Help me with this issue.

EPiServer.Find.LambdaExpressionExtensions._cache keeps growing indefinately

$
0
0

The private static field EPiServer.Find.LambdaExpressionExtensions._cache keeps growing indefinately even when executing the same query and receiving the same result over and over. This will eventually lead to the worker process running out of memory (in our case, quite frequently).

Below is a code snippet that re-creates the behavior.

// The simplest possible query returning the same result every time will still
// increase the number of entries in the cache.

var cacheField = typeof(LambdaExpressionExtensions)
    .GetField("_cache", BindingFlags.NonPublic | BindingFlags.Static);

var cache = cacheField.GetValue(null) as ConcurrentDictionary<Expression, Delegate>;

cache.Clear();

Debug.Assert(cache.Count == 0);

var findClient = ServiceLocator.Current.GetInstance<IClient>();

// Make the simplest possible query to return one hit.

var firstHits = findClient.UnifiedSearch().Take(1).GetResult().Hits.ToList();

Debug.Assert(firstHits.Count == 1);

var firstHitID = firstHits[0].Id;

var firstHitCacheCount = cache.Count;

// The initial query should of course add entries to the cache. About 25 in my case.
Debug.Assert(firstHitCacheCount > 0);

// Make the same query in a loop.
for (var i = 0; i < 10; i++)
{
    var loopedHits = findClient.UnifiedSearch().Take(1).GetResult().Hits.ToList();

    Debug.Assert(loopedHits.Count == 1);

    var loopedHitID = loopedHits[0].Id;

    Debug.Assert(loopedHitID == firstHitID);

    var loopedHitCacheCount = cache.Count;

    // Given the same search query and the same result, the cache should not grow.
    // It grows with each iteration.
    Debug.Assert(loopedHitCacheCount <= firstHitCacheCount);
}

Visitor Groups criteria with load balanced env

$
0
0

Hello

We use episerver CMS site 10.5 version. 

There are configured visitor groups criteria content (user IP criteria) - block with settings which are used in custom frontend widget (some booking widget).

So users from different Ip's see different settings. It works fine on our DEV env. But on PROD a load balancer (AWS hosting) is configured.

We have several versions of Web.config and transformations. On Web.Production.config is set specific parameter to use header for load balanced configurations:  

<appSettings>
<add key="episerver:ClientIPAddressHeader" value="X-Forwarded-For" xdt:Transform="InsertIfMissing" xdt:Locator="Match(key)"/>
</appSettings>

Also custom episerver Ip resolver was injected:

ClientIpAddressResolver : IClientIPAddressResolver

I added to the custom IP resolver traces and logging and see that method ResolveAddress returns correct IP address of user (not a load balancer IP) even on PROD site.

Also tried to define explicitly header with 'right' Ip address on Custom Ip resolver (to exclude version that web.config is not affects): 

private const string HeaderName = "X-Forwarded-For";

But visitor group content still not working. 

Another version is a caching on hosting side but AWS support says that there is no specific cache for PROD site. 

Bookmarks feature in Episerver

$
0
0

Hello,

I have a requirement to implement bookmarks feature in EpiServer. So when a user logs in, he could mark a content as favorite.

I will be storing userid and corresponding content id in a table. Assuming this will require me to create a new table in EPiServer database (not creating new database here since only one table)

Also when user logs in, I will be quering agains this DB table to fetch all content ids and load those content for user to view.

Can some one guide me on how to proceed on Database interaction in EpiServer and any best practices or reference links. I have seen link in this forum that talks about this feature already so if anyone can post some details that would be helpful.

Custom visitor group criterion state storage in Epi 10

$
0
0

I want that visitors can see content only if the URL contains a specific key and value in url-parameters, for example `?clienttype=business`.

For that i have created following classes.

Setting class:

[EPiServerDataStore(AutomaticallyRemapStore = true)]
[PublicAPI("Used in module episerver vistorgroups")]
public class UrlParameterValidationSettings : CriterionModelBase, IValidateCriterionModel, ICriterionSettings
{
    public CriterionValidationResult Validate(VisitorGroup currentGroup)
    {
		if (string.IsNullOrWhiteSpace(Key))
		{
			return new CriterionValidationResult(false, $"{nameof(Key)} must not be empty");
		}
		if (string.IsNullOrWhiteSpace(Value))
		{
			return new CriterionValidationResult(false, $"{nameof(Value)} must not be empty");
		}
		return CriterionValidationResult.Valid;
	}
	public override ICriterionModel Copy()
	{
		return ShallowCopy();
	}
	public string Key { get; set; }
	public string Value { get; set; }
	public bool IsDeny { get; set; }
}

Criterion class:

[VisitorGroupCriterion(
	Category = "Custom Criterion",
	DisplayName = "URL-Parameter exists with a given value",
	Description = "Checks if a URL-Parameter exists with a given value")]
public class UrlParameterValidationCriterion : CriterionBase<UrlParameterValidationSettings>
{
	public override bool IsMatch(IPrincipal principal, HttpContextBase httpContext)
	{
		NameValueCollection requestParameters = httpContext.Request.QueryString;
		string value = requestParameters[Model.Key];
		bool matchingUrlParameter = value != null && StringComparer.InvariantCultureIgnoreCase.Equals(Model.Value, value);
		return Model.IsDeny ? !matchingUrlParameter : matchingUrlParameter;
	}
}


It works. But now i want that it will be validated only once and then keeps it value the whole browser-session. Currently it seems that it checks the url-parameter on every request. 

Even if i use the builtin "Visitor Group Membership" and add there a custom visitor group with the above criterion, it will always validate it on every request.

Is it a misunderstanding on my side how visitor groups work, or what is the correct way to implement this requirement? 

We are still on EPI 10 but will switch to 11 soon. Is this change in EPI11 what i am looking for or is it already possible in 10?


Find for text having special characters

$
0
0

Do we have a list of characters that are reserved or not expected to be part of string search?

Reason: I have some pages that start with "@" and If i have two pages with similar name, one that starts with @ and other that doesn't and if I search for page starting with @, I don't get this page as first result. Looks like this @ is completely ignored or escaped. Similar behaviour can be seen in EPiServer CMS when you search for a page.

I haven't got chance to validate the other special characters yet so the question, is it not advisable to have pages or blocks that are indexed to start with @ or $ or !.

"IExtendedProperties" on payment disappear after saving cart as a purchaseOrder

$
0
0

Hi Forum,

I have a question about "IExtendedProperties". After saving a cart as a purchaseOrder, the values added to "IExtendedProperties" on payments disappear.

Is it a bug or intended behavior. Do I misunderstand something? :)

Screenshot cart order form
https://screenpresso.com/=j1wlf

Screenshot purchaseOrder order form
https://screenpresso.com/=DZgdc

Code

var orderReference = _orderRepository.SaveAsPurchaseOrder(cart);
var purchaseOrder = _orderRepository.Load<IPurchaseOrder>(orderReference.OrderGroupId);

EpiServer.Business.Commerce
12.17.2.3575

BR
Lasse

"First time" file upload failing

$
0
0

Experiencing a bug when uploading a file for the first time on an EpiServer page.

Using the "+"-button as the image shows:

I get the following result with the "Content type "DocumentFile" is not allowed..."-message when hovering on "Mislyktes" (Norwegian for "Failed"):

The "DocumentFile" is defined as follows:

Getting this console message if helpful:

If I, however, use drag and drop to add the first file - it works. And when I then add a new file with the "+"-button after a file is uploaded with drag and drop, this will now also work.

So, the issue only occurs when uploading a file with the "+"-button the first time.

Is this a known issue? Or does anyone have an idea what causes this behavior?

Running EpiServer 11.12

How to enumerate blocks of contentarea in view to render?

$
0
0

How to enumerate blocks of contentarea in view to render?
e.g.@Html.PropertyFor(block1 of contentarea)
@Html.PropertyFor(block2 of contentarea)

I tried to use Model.CurrentPage.ContentArea.Items.OfType<EPiServer.Core.BlockData>(). But how to use this in view?

EPiServer 11 - EPiServer.Search Shell.Search not working

$
0
0

There are atleast two search elements in the UI. The one Im refering to for this case is the one located in the top menu. (The magnifying glass)

The issue is that "nothing" happens when you click on the magnifying glass.

Some debugging steps I have been through:

  • Created a new alloy app (MVC), and then tested that search. And it works.. 

This led me to start comparing things..

I opened the chrome devtools to see exactly what happens when you click the magnifying glass. And here we have some difference in the behavior between the Alloy App and my app. As soon as you click the magnifying glass, a request is done towards: ~/EPiServer/shell/Search/Index?searchArea=null

In the alloy case, that endpoint returns some markup. But for my app, the response is completly empty.

My App:

Alloy:

Verbose logging output result is:

2018-05-18 12:53:19,974 [25] DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/EPiServer/shell/Search/Index' since it doesn't start with '~/EPiServer/CMS/11.4.4'
2018-05-18 12:53:19,976 [25] DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/EPiServer/shell/Search/Index' since it doesn't start with '~/EPiServer/Shell/11.4.4'
2018-05-18 12:53:19,977 [25] DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/EPiServer/shell/Search/Index' since it doesn't start with '~/EPiServer/EPiServer.Cms.TinyMce/2.1.2'
2018-05-18 12:53:19,978 [25] DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/EPiServer/shell/Search/Index' since it doesn't start with '~/EPiServer/EPiServer.Packaging.UI/3.4.0.0'
2018-05-18 12:53:19,981 [25] DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/EPiServer/shell/Search/Index' since it doesn't start with '~/EPiServer/EPiServer.Search.Cms'
2018-05-18 12:53:19,982 [25] DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Found route with values moduleArea=shell, controller=Search, action=Index, id= for path:~/EPiServer/shell/Search/Index
2018-05-18 12:53:19,983 [25] DEBUG EPiServer.Shell.Web.Mvc.ModuleControllerFactory: Creating controller 'Search' with type: EPiServer.Shell.UI.Controllers.EPiSearchController
2018-05-18 12:53:19,984 [25] DEBUG EPiServer.Shell.Web.Mvc.ModuleMvcHandler: Resolved 'Search' to controller: EPiServer.Shell.UI.Controllers.EPiSearchController
2018-05-18 12:53:19,989 [25] INFO EPiServer.Shell.Search.SearchProvidersManager: Listing search providers within search area: null
2018-05-18 12:53:19,990 [25] INFO EPiServer.Shell.Search.SearchProvidersManager: Loading search settings
2018-05-18 12:53:19,993 [25] TRACE EPiServer.Data.Providers.Internal.SqlDatabaseExecutor: Initializing a new instance of SqlDatabaseHandler
2018-05-18 12:53:19,996 [25] TRACE EPiServer.Data.Providers.Internal.SqlDatabaseExecutor: Opening a new transaction-less connection
2018-05-18 12:53:19,999 [25] TRACE EPiServer.Data.Providers.Internal.ConnectionContext: Opening Connection
2018-05-18 12:53:20,004 [25] TRACE EPiServer.Data.Providers.Internal.ConnectionContext: Closing Connection
2018-05-18 12:53:20,006 [25] DEBUG EPiServer.Shell.Web.Mvc.ModuleViewEngineCollection: Returning view engine for module: [ShellModule Name='Shell' RouteBasePath='EPiServer/' ResourceBasePath='/EPiServer/Shell/' ClientResourcePath='/EPiServer/Shell/11.4.4/' Assemblies=[EPiServer.Shell, EPiServer.Shell.UI, EPiServer.ApplicationModules] Controllers=[ComponentCategoryStore, ComponentDefinitionStore, ComponentSortOrderStore, ComponentStore, ContextStore, LicenseInformationStore, MetadataStore, ProfileStore, SearchProviderStore, SearchResultStore, SelectionQueryStore, UIDescriptorStore, LicenseInformationStore, EPiAboutController, EPiDashboardController, EPiDebugController, EPiDefaultShellModuleController, EPiLicensingController, EPiMetadataManagerController, EPiResourcesController, EPiSearchController, EPiSettingsController, PreviewUnavailableController, VisitorGroupsStatisticsController]]
2018-05-18 12:53:22,908 [45] DEBUG EPiServer.Search.Internal.RequestQueueHandler: Start dequeue unprocessed items
2018-05-18 12:53:22,910 [45] TRACE EPiServer.Data.Providers.Internal.SqlDatabaseExecutor: Opening a new transaction-less connection
2018-05-18 12:53:22,913 [45] TRACE EPiServer.Data.Providers.Internal.ConnectionContext: Opening Connection
2018-05-18 12:53:22,934 [45] DEBUG EPiServer.Data.Dynamic.Providers.Internal.DbDataStoreProvider: LINQ Expression:
value(EPiServer.Data.Dynamic.Internal.DynamicDataStoreOrderedQueryable`1[EPiServer.Search.Data.IndexRequestQueueItem]).Where(queueItem => (queueItem.NamedIndexingService == value(EPiServer.Search.Internal.RequestQueue+<>c__DisplayClass4_0).namedIndexingService))
value(EPiServer.Data.Dynamic.Providers.Internal.SqlServerQueryProvider`1[EPiServer.Search.Data.IndexRequestQueueItem]).OrderBy(queueItem => queueItem.Timestamp)
value(EPiServer.Data.Dynamic.Providers.Internal.SqlServerQueryProvider`1[EPiServer.Search.Data.IndexRequestQueueItem]).Take(50)
Generated SQL: SELECT "Id" FROM ( SELECT "IndexRequestQueueDataStore".Id, Row_Number() OVER (ORDER BY "IndexRequestQueueDataStore".[Timestamp] ASC) FROM  [dbo].[VW_IndexRequestQueueDataStore] as "IndexRequestQueueDataStore"   WHERE "IndexRequestQueueDataStore".[NamedIndexingService]  =  @Param0) AS InnerSelect("Id", [Row_Number()]) WHERE [Row_Number()] BETWEEN 1 AND 50>

Did I install EPiServer.Search incorrectly? The thing is that the search component which is located just above the EPiServer content-tree 

Is working just fine 

We did upgrade from 10 => 11 a while back ago, could that be the issue?
I have diffed the Alloy Web.config with ours, not much is different there..
I have tested to run our app with the alloy database (same result)
I have tested to run the alloy with our database (the search still works)

I'm rather new to EPi, and I feel like I have exhausted the debugging steps that I can think of. If you have anything you want me to test, just shoot and I'll test asap.

Any help would be highly appreciated.

Thank you

CacheEvictionPolicy - non-obsolete way to set expiration?

$
0
0

The constructor for CacheEvictionPolicy that takes a TimeSpan expiration is obsolete. It is also not possible to set the expiration on the CacheEvictionPolicy after construction. Is there a non-obsolete way to achieve this?

DXC Deployments - Json Transfoms

$
0
0

In DXC we can use Web.config transforms to modify our web.configs for different environments e.g. production.

My current project has json files which need transforms applied for various environments. Azure deploments also supports json config\transforms via JSON variable substitution as in link below.

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/transforms-variable-substitution?view=azure-devops#json-variable-substitution

Is it posible to perform\configure JSON variable substitution for DXC deployments and if not what is the wrokaround?


ISynchronizedObjectInstanceCache - how do I get all the keys in the cache?

$
0
0

Is there a way to get all the keys from an ISynchronizedObjectInstanceCache instance?

Swish for Episerver DIBS payment provider?

$
0
0

Hi!

We are currently using the Episerver DIBS payment provider found here: https://world.episerver.com/add-ons/dibs/

Our customer would now like to implement Swish payments, could that be done with the plugin above?
I know DIBS has the support but I'm not sure what version of DIBS you need etc, maybe someone has implementet Swish in Commerce via DIBS and can help?

Regards,
Kristoffer

403 Using the Insights Profile endpoint

$
0
0

Hello

I'm currently trying to hit our Insights Profile endpoint with Postman to retrieve a single profile but am only receiving a 403. In the Swagger documentation there is a Epi-User-Name header that is required which I can't see documented anywhere in the documentation on EPi world (https://world.episerver.com/documentation/developer-guides/profile-store/profile-store-api/profiles/querying-profiles/), not sure what actual username I should be using for this. I have used the CMS admin login but am having no luck.

Any help would be appreciated.

Thanks David

Add new filters to Quicksilver

$
0
0

Hi!

I am trying to figure out how filtering products in Quicksilver works.

I have added a property to a variant:

[CatalogContentType (
        GUID = "D9181050-28AE-4B31-8498-B5D831F13610",
        MetaClassName = "TestVariant",
        DisplayName = "Test Variant",
        Description = "Display Test variant" )]
    public class TestVariant : FashionVariant
    {
        [Ignore]
        [ScaffoldColumn ( false )]
        public override string Size { get; set; }
        [Searchable]
        [CultureSpecific]
        [Tokenize]
        [IncludeInDefaultSearch]
        [BackingType(typeof(PropertyBoolean))]
        [Display(Name = "Prop1-test", Order = 10)]
        public virtual bool Prop1 { get; set; }
    }

And this property is visible in the variant edit page. But how can I add this to the filters on the catalog page (like Color, Size on existing fashion variants )?

I have added filter to the config file:

<filter field="Prop1"><Descriptions defaultLocale="en"><Description locale="en">Prop1</Description><Description locale="sv">Prop1</Description><Values><SimpleValue key="true" value="true"><Descriptions defaultLocale="en"><Description locale="en">true</Description><Description locale="sv">true</Description></Descriptions></SimpleValue><SimpleValue key="false" value="false"><Descriptions defaultLocale="en"><Description locale="en">false</Description><Description locale="sv">false</Description></Descriptions></SimpleValue></Values></Descriptions></filter>

I am also adding them to document fields in the SearchDocumentController:

private void AddTestProperties1(RestSearchDocument document, IEnumerable<TestVariant> variants)
        {
            var props = new List<bool>();
            foreach (var testVariant in variants)
            {
                if (!props.Contains(testVariant.Prop1))
                {
                    props.Add(testVariant.Prop1);
                    document.Fields.Add(new RestSearchField("Prop1", testVariant.Prop1.ToString().ToLower()));
                }
            }
        }

Even after indexing the search index (in commerce and in admin) nothing happens.

And why does the filter option for sizes dissapear when I select shoes?

Accessing the ~/modules folder in Azure

$
0
0

Hi!

We have build a plugin to Episerver where we put views, js and css in the ~/modules/MyPlugin/ and it works just fine local and on a normal server. But when we deploy to Azure we get this problem:

[InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/ContentTranslationHistory/Index.cshtml
~/Views/ContentTranslationHistory/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
~/Views/ContentTranslationHistory/Index.aspx
~/Views/ContentTranslationHistory/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/modules/MyPlugin/ContentTranslationHistory/Index.cshtml]

The view are locates here: ~/modules/MyPlugin/ContentTranslationHistory/Index.cshtml

But MVC does not find it in Azure. Works perfect on all other environments. Any ideas?

Thanks!

/Kristoffer

Viewing all 6894 articles
Browse latest View live