Gravatar for

Question by Paul Tiemann, Jan 11, 2019 8:53 PM

Adding search box causes: Exception: Sitecore.Data.Query.ParseException Message: End of string expected at position 4:

I'm trying to insert a Coveo SearchBox in the Searchbox placeholder inside a Default Frame rendering.
Current Coveo for Sitecore version:
Current Sitecore version: Diagnostics indicate green for everything.
Steps to reproduce

  1. Insert new page (custom template for our project and uses a custom layout for our project)
  2. Create parameter folder using Insert from template using Coveo Local Parameters Folder under new page
  3. Insert Coveo Search Interface in Page Content Placeholder
  4. Insert Default Frame in UI Content Placeholder
  5. Attempt to insert Search Box in Searchbox placeholder. Error happens.

Second scenario

  1. Insert page (again custom)
  2. Insert from a template using Coveo Local Parameters Folder to create a folder under the new page
  3. Change layout to Basic Search Interface Layout
  4. Insert Coveo Search Interface into Coveo UI placeholder, datasource set to newly create search interface data item in Search Interfaced folder
  5. Insert Coveo Search Resources into UI Resources placeholder. The error happens again.

Error stack below from log:

10276 20:47:03 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nested Exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
   at Sitecore.Nexus.Pipelines.NexusPipelineApi.Resume(PipelineArgs args, Pipeline pipeline)
   at Sitecore.Web.UI.Sheer.ClientPage.ResumePipeline()
   at Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e)
   at Sitecore.Shell.Applications.WebEdit.WebEditRibbon.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Nested Exception
Exception: Sitecore.Data.Query.ParseException
Message: End of string expected at position 4.
Source: Sitecore.Kernel
   at Sitecore.Data.Query.QueryParser.Raise(String error)
   at Sitecore.Data.Query.QueryParser.DoParse(String query)
   at Sitecore.Data.Query.Query..ctor(String query)
   at Sitecore.Data.Query.Query.SelectItems(String query, QueryContext contextNode, Database database)
   at Score.Custom.Pipelines.Editor.QueryableDatasourceLocation.DoProcess(Item contextItem, GetRenderingDatasourceArgs args)
   at Score.Custom.Pipelines.Editor.QueryableDatasourceLocation.Process(GetRenderingDatasourceArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Shell.Applications.WebEdit.Commands.AddRendering.Run(ClientPipelineArgs args)

Gravatar for

Comment by Jean-François L'Heureux, Jan 14, 2019 11:04 AM

Is this a fresh installation of Coveo for Sitecore or is this an upgrade from a previous version?

Gravatar for

Comment by Paul Tiemann, Jan 14, 2019 2:02 PM

This is a fresh installation however a Sitecore package of a custom framework which does use some Coveo functions for listing pages was installed. This framework uses an older version 4.x of Coveo Cloud so I wouldn't discount that there could be a version conflict or config file change causing this issue. I did make a backup of the web root before installing this package and I've compared the bin and app_config folders and Coveo items seem to be unchanged. If there are any specifics I can look at please let me know.

Gravatar for

Comment by Paul Tiemann, Feb 12, 2019 8:30 PM

@François Lachance-Guillemette

I have a new problem with this. Since I posted this issue, we had to roll back to Coveo 4.1 to maintain compatibility with another website using the same internal framework (based on Brainjocks). After adding this fix, I now see that I cannot set the data source location on many renderings including Coveo Global Search Interface. I don't get an error, but it can't find the Coveo Global Parameters. This worked on my DEV system but not on the Integration server. I used RAZL to compare my instance and see that when I rolled my Coveo back, I missed some of the renderings settings. It looks like in 5 Coveo changed the Datasource Location query to:

./|query:./ancestor::content/[@@templateid='{4834979E-74D4-40A2-915E-E3678727664B}']/[@@templateid = '{011C7C50-34C6-402E-8306-DDC77D4E5F71}']



Do you have a workaround for version 4 of Coveo Cloud as commenting out query:fast just steps over the error without letting me set it correctly.

1 Reply
Gravatar for

Answer by François Lachance-Guillemette, Jan 14, 2019 4:09 PM

This is an incompatibility that is found with Brainjocks' Score framework not being able to recognize fast queries (`query:fast`) in data source locations.

Their workaround was to ignore `query:fast` when defined in the data source location with the following class:

public class QueryableDatasourceLocation : Score.Custom.Pipelines.Editor.QueryableDatasourceLocation
    public override void DoProcess(Item contextItem, GetRenderingDatasourceArgs args)
        if (args.RenderingItem["Datasource Location"].Contains("query:fast:")) return;
            base.DoProcess(contextItem, args);

You can then replace the original processor by this new version:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="">
        patch:instead="*[@type='Score.Custom.Pipelines.Editor.QueryableDatasourceLocation, Score.Custom']"
        type="NAMESPACE.QueryableDatasourceLocation, ASSEMBLY" />

Since we have discovered this issue, we talked with Brainjocks, and the last news with had with them was that they were going to support it.

Gravatar for

Comment by Paul Tiemann, Jan 14, 2019 4:15 PM

LOL I writing this response to say that I just figured out that it was in SCORE pipeline code and worked around it by commenting out the SCORE processor here:

          patch:before="*[@type='Sitecore.Pipelines.GetRenderingDatasource.GetDatasourceLocation, Sitecore.Kernel']"
          type="Score.Custom.Pipelines.Editor.QueryableDatasourceLocation, Score.Custom" />

Your response gives me much more detail and how to update to step around the processor correctly without removing it entirely.



Gravatar for

Comment by Paul Tiemann, Jan 17, 2019 3:02 PM

Thank you for the update!

Ask a question