Cannot parse '__IndexType:content': Encountered "<EOF>" Error using
We are creating an API to access some of the content stored in Umbraco from a separate app. When we make the calls initially it pulls the data down correctly after that however it starts throwing this error:
Cannot parse '__IndexType:content': Encountered "<EOF>" at line 1, column 0. Was expecting one of:
<NOT> ...
"+" ...
"-" ...
<BAREOPER> ...
"(" ...
"*" ...
<QUOTED> ...
<TERM> ...
<PREFIXTERM> ...
<WILDTERM> ...
<REGEXPTERM> ... ...
The API code is:
[HttpGet("search")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public ActionResult<IEnumerable<DocumentInfo>> GetBySearchTerm([FromQuery] string term)
{
if (string.IsNullOrWhiteSpace(term))
{
return NotFound("Missing parameter 'term'");
}
List<DocumentInfo> documentDetails;
try
{
var publishedSearchResults = _publishedContentQuery.Search(term).ToList();
documentDetails = publishedSearchResults.Select(x => PopulateDocumentInfo(x.Content))
.ToList();
}
catch (Exception ex)
{
// _logger.LogError(ex, $"Get notifications for user {id} failed for type {notificationType}");
return StatusCode(StatusCodes.Status500InternalServerError, "Get By Search Term failed");
}
return documentDetails;
}
Any ideas where this could be coming from or have we found a V9 bug?
Try to rebuild the external index in backoffice, and the if the error still occurs..
My simple example looks like this
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Web.Common.Controllers;
namespace UmbracoTestSite
{
public class SearchController : UmbracoApiController
{
private readonly IPublishedContentQuery _publishedContentQuery;
public SearchController(IPublishedContentQuery publishedContentQuery)
{
_publishedContentQuery = publishedContentQuery;
}
[HttpGet("search")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public ActionResult<IEnumerable<DocumentInfo>> GetBySearchTerm([FromQuery] string term)
{
if (string.IsNullOrWhiteSpace(term))
{
return NotFound("Missing parameter 'term'");
}
List<DocumentInfo> documentDetails;
try
{
var publishedSearchResults = _publishedContentQuery.Search(term).ToList();
documentDetails = publishedSearchResults.Select(x => PopulateDocumentInfo(x.Content))
.ToList();
}
catch (Exception ex)
{
// _logger.LogError(ex, $"Get notifications for user {id} failed for type {notificationType}");
return StatusCode(StatusCodes.Status500InternalServerError, "Get By Search Term failed");
}
return documentDetails;
}
private DocumentInfo PopulateDocumentInfo(IPublishedContent argContent)
{
return new DocumentInfo(argContent);
}
}
public class DocumentInfo
{
public DocumentInfo(IPublishedContent content)
{
Name = content.Name;
}
public string Name { get; init; }
}
}
Cannot parse '__IndexType:content': Encountered "<EOF>" Error using
We are creating an API to access some of the content stored in Umbraco from a separate app. When we make the calls initially it pulls the data down correctly after that however it starts throwing this error:
The API code is:
Any ideas where this could be coming from or have we found a V9 bug?
Your code seems correct, it works fine for me..
Try to rebuild the external index in backoffice, and the if the error still occurs..
My simple example looks like this
Not 100% sure what fixed this issue but it seems that upgrading to the release version stopped this error.
is working on a reply...