I've tried implementing a basic search into my site, however I'm getting an EOF error when running it. I'm passing in "eng" as my term with no spaces or special characters.
code:
if (!_examineManager.TryGetIndex(UmbracoIndexes.ExternalIndexName, out IIndex index))
throw new InvalidOperationException($"No index found by name {UmbracoIndexes.ExternalIndexName}");
var searcher = index.Searcher;
var results = searcher.CreateQuery(IndexTypes.Content)
.Field("nodeName", searchTerm.MultipleCharacterWildcard())
.Execute();
error:
Lucene.Net.QueryParsers.Classic.ParseException
HResult=0x80131500
Message=Cannot parse '__IndexType:content': Encountered "<EOF>" at line 1, column 0.
Was expecting one of:
<NOT> ...
"+" ...
"-" ...
<BAREOPER> ...
"(" ...
"*" ...
<QUOTED> ...
<TERM> ...
<PREFIXTERM> ...
<WILDTERM> ...
<REGEXPTERM> ...
"[" ...
"{" ...
<NUMBER> ...
<TERM> ...
"*" ...
Source=Lucene.Net.QueryParser
StackTrace:
at Lucene.Net.QueryParsers.Classic.QueryParserBase.Parse(String query)
at Examine.Lucene.Search.LuceneSearchQueryBase.ParseRawQuery(String rawQuery)
at Examine.Lucene.Search.LuceneSearchQueryBase.GetFieldInternalQuery(String fieldName, IExamineValue fieldValue, Boolean useQueryParser)
at Examine.Lucene.Search.LuceneSearchQuery.Search(QueryOptions options)
at Examine.Lucene.Search.LuceneSearchQuery.Execute(QueryOptions options)
at Examine.Lucene.Search.LuceneBooleanOperation.Execute(QueryOptions options)
at FatMedia.BlackburnCollege.Services.Search.SearchService.FatMedia.BlackburnCollege.Services.Search.ISearchService.SiteSearch(String searchTerm) in C:\Projects\BlackburnCollege\src\FatMedia.BlackburnCollege.Services\Search\SearchService.cs:line 29
at FatMedia.BlackburnCollege.Web.Controllers.CourseApi.CourseApiController.Search(SearchRequestModel requestModel) in C:\Projects\BlackburnCollege\src\FatMedia.BlackburnCollege.Web\Controllers\CourseApi\CourseApiController.cs:line 25
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
ParseException: Encountered "<EOF>" at line 1, column 0.
Was expecting one of:
<NOT> ...
"+" ...
"-" ...
<BAREOPER> ...
"(" ...
"*" ...
<QUOTED> ...
<TERM> ...
<PREFIXTERM> ...
<WILDTERM> ...
<REGEXPTERM> ...
"[" ...
"{" ...
<NUMBER> ...
<TERM> ...
"*" ...
Umbraco 9 Search - EOF
I've tried implementing a basic search into my site, however I'm getting an EOF error when running it. I'm passing in "eng" as my term with no spaces or special characters.
code:
error:
We found a fix for this issue by update our code as below:
is working on a reply...