mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Enterprise Search] Do not include precision_enabled in requests for precision tuning (#137220) (#137563)
This commit is contained in:
parent
867c736ddc
commit
3d0a7cacf0
4 changed files with 20 additions and 5 deletions
|
@ -549,6 +549,8 @@ describe('RelevanceTuningLogic', () => {
|
|||
},
|
||||
],
|
||||
},
|
||||
precision: 5,
|
||||
precision_enabled: true,
|
||||
};
|
||||
|
||||
const searchSettingsWithoutNewBoostProp = {
|
||||
|
@ -561,6 +563,7 @@ describe('RelevanceTuningLogic', () => {
|
|||
},
|
||||
],
|
||||
},
|
||||
precision: 5,
|
||||
};
|
||||
mount({
|
||||
searchSettings: searchSettingsWithNewBoostProp,
|
||||
|
|
|
@ -65,10 +65,13 @@ export interface SearchField {
|
|||
weight: number;
|
||||
}
|
||||
|
||||
export interface SearchSettings {
|
||||
export interface SearchSettingsRequest {
|
||||
boosts: Record<string, Boost[]>;
|
||||
search_fields: Record<string, SearchField>;
|
||||
result_fields?: object;
|
||||
precision: number;
|
||||
}
|
||||
|
||||
export interface SearchSettings extends SearchSettingsRequest {
|
||||
precision_enabled: boolean;
|
||||
}
|
||||
|
|
|
@ -58,8 +58,10 @@ describe('removeBoostStateProps', () => {
|
|||
precision: 10,
|
||||
precision_enabled: true,
|
||||
};
|
||||
const { precision_enabled: precisionEnabled, ...searchSettingsWithoutPrecisionEnabled } =
|
||||
searchSettings;
|
||||
expect(removeBoostStateProps(searchSettings)).toEqual({
|
||||
...searchSettings,
|
||||
...searchSettingsWithoutPrecisionEnabled,
|
||||
boosts: {
|
||||
foo: [
|
||||
{
|
||||
|
|
|
@ -9,15 +9,22 @@ import { cloneDeep, omit } from 'lodash';
|
|||
|
||||
import { SchemaType } from '../../../shared/schema/types';
|
||||
|
||||
import { RawBoost, Boost, SearchSettings, BoostType, ValueBoost } from './types';
|
||||
import {
|
||||
RawBoost,
|
||||
Boost,
|
||||
SearchSettingsRequest,
|
||||
SearchSettings,
|
||||
BoostType,
|
||||
ValueBoost,
|
||||
} from './types';
|
||||
|
||||
// If the user hasn't entered a filter, then we can skip filtering the array entirely
|
||||
export const filterIfTerm = (array: string[], filterTerm: string): string[] => {
|
||||
return filterTerm === '' ? array : array.filter((item) => item.includes(filterTerm));
|
||||
};
|
||||
|
||||
export const removeBoostStateProps = (searchSettings: SearchSettings): SearchSettings => {
|
||||
const updatedSettings = cloneDeep(searchSettings);
|
||||
export const removeBoostStateProps = (searchSettings: SearchSettings): SearchSettingsRequest => {
|
||||
const { precision_enabled: precisionEnabled, ...updatedSettings } = cloneDeep(searchSettings);
|
||||
const { boosts } = updatedSettings;
|
||||
const keys = Object.keys(boosts);
|
||||
keys.forEach((key) => boosts[key].forEach((boost) => delete boost.newBoost));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue