Shazwazza / Examine

A .NET indexing and search engine powered by Lucene.Net
https://shazwazza.github.io/Examine/
380 stars 123 forks source link

Field $facets was not indexed with SortedSetDocValues #388

Closed BramvdBogaard closed 3 months ago

BramvdBogaard commented 4 months ago

I'm using the newest beta 4.0.0-beta1 to use faceted searches (which is awesome!)

Unfortunately I've made my site multilingual (added Dutch to the default English) and now I keep getting the error Field $facets was not indexed with SortedSetDocValues.

In my query I add the following steps, in which I add 5 faceted fields.

var result = query .OrderBy(IsDescending(request.OrderBy), GetOrderFields(request.OrderBy)) .WithFacets(facets => { facets.FacetString(Defaults.ExternalIndex.TrainingFields.RelatedAudience); facets.FacetString(Defaults.ExternalIndex.TrainingFields.RelatedLocation); facets.FacetString(Defaults.ExternalIndex.TrainingFields.RelatedPartner); facets.FacetString(Defaults.ExternalIndex.TrainingFields.RelatedTimezone); facets.FacetString(Defaults.ExternalIndex.TrainingFields.RelatedTraining); }) .Execute(queryOptions);

I've registered the Facets like this:

`var facetsConfig = new FacetsConfig();

        facetsConfig.DimConfigs.Add(Defaults.ExternalIndex.TrainingFields.RelatedAudience, new FacetsConfig.DimConfig { IsMultiValued = true });
        facetsConfig.DimConfigs.Add(Defaults.ExternalIndex.TrainingFields.RelatedLocation, new FacetsConfig.DimConfig { IsMultiValued = true });
        facetsConfig.DimConfigs.Add(Defaults.ExternalIndex.TrainingFields.RelatedPartner, new FacetsConfig.DimConfig { IsMultiValued = true });
        facetsConfig.DimConfigs.Add(Defaults.ExternalIndex.TrainingFields.RelatedTimezone, new FacetsConfig.DimConfig { IsMultiValued = true });
        facetsConfig.DimConfigs.Add(Defaults.ExternalIndex.TrainingFields.RelatedTraining, new FacetsConfig.DimConfig { IsMultiValued = true }); `

The fieldTypes are all FacetFullText options.FieldDefinitions.AddOrUpdate(new FieldDefinition(Defaults.ExternalIndex.TrainingFields.RelatedAudience, FieldDefinitionTypes.FacetFullText)); options.FieldDefinitions.AddOrUpdate(new FieldDefinition(Defaults.ExternalIndex.TrainingFields.RelatedLocation, FieldDefinitionTypes.FacetFullText)); options.FieldDefinitions.AddOrUpdate(new FieldDefinition(Defaults.ExternalIndex.TrainingFields.RelatedPartner, FieldDefinitionTypes.FacetFullText)); options.FieldDefinitions.AddOrUpdate(new FieldDefinition(Defaults.ExternalIndex.TrainingFields.RelatedTimezone, FieldDefinitionTypes.FacetFullText)); options.FieldDefinitions.AddOrUpdate(new FieldDefinition(Defaults.ExternalIndex.TrainingFields.RelatedTraining, FieldDefinitionTypes.FacetFullText));

Am I doing something wrong or did I run into a bug in Examine? Thanks in advance

Shazwazza commented 3 months ago

@nzdev any ideas on this one?

nzdev commented 3 months ago

This was solved on the Umbraco discord. The gist is on Umbraco, the extra languages are new fields, and were not configured to use the facet or taxonomy field type. For each language, this needs to be set up manually. https://discord.com/channels/869656431308189746/1257684691637764246