{SOLVED] Add field to internal index (internal sea...
# help-with-umbraco
s
Have a code field that the admins would like to use in the Umbraco internal backoffice search. I've tried adding this field to the internal index (pretty sure that's what's used in the internal search?). I can see this code getting hit on startup but doesn't seem to affect the search results. Can anyone spot any issues? using Examine; using Examine.Lucene; using Microsoft.Extensions.Options; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Composing; namespace ZZ.Web.v10.Extensions { public class ConfigureInternalIndexOptions : IConfigureNamedOptions { public void Configure(string name, LuceneDirectoryIndexOptions options) { if (name.Equals(Constants.UmbracoIndexes.InternalIndexName)) { options.FieldDefinitions.AddOrUpdate(new FieldDefinition("code", FieldDefinitionTypes.FullText)); } } public void Configure(LuceneDirectoryIndexOptions options) { throw new System.NotImplementedException(); } } public class ExamineComposer : IComposer { public void Compose(IUmbracoBuilder builder) { builder.Services.ConfigureOptions(); } } }
j
You need to specify the fields the backoffice search should use: https://docs.umbraco.com/umbraco-cms/extending/backoffice-search
Perfect! Thanks - not sure how I missed that in my various searches to solve this! Works perfectly now.
s
Ps: three backticks (+language) will make your code more readable in the future. example:
Copy code
csharp
using Examine;
using Examine.Lucene;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;

namespace ZZ.Web.v10.Extensions
{
    public class ConfigureInternalIndexOptions : IConfigureNamedOptions<LuceneDirectoryIndexOptions>
    {

... etc
4 Views