提交 de249a04 编写于 作者: R Rob Lourens

Add experimentalFuzzySearchBoost so we can test changes to the 'boost'...

Add experimentalFuzzySearchBoost so we can test changes to the 'boost' parameter in the search query
上级 40bd3533
......@@ -216,6 +216,11 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = {
'description': nls.localize('experimentalFuzzySearchKey', "Indicates the key to use for the experimental settings search."),
'default': ''
},
'workbench.settings.experimentalFuzzySearchBoost': {
'type': 'number',
'description': 'Indicates the amount to boost the "literal" component of the query. Temporary.',
'default': 10
},
'workbench.sideBar.location': {
'type': 'string',
'enum': ['left', 'right'],
......
......@@ -18,6 +18,7 @@ import { IWorkspaceConfigurationService } from 'vs/workbench/services/configurat
export interface IEndpointDetails {
urlBase: string;
key: string;
boost: number;
}
export class PreferencesSearchProvider {
......@@ -37,7 +38,8 @@ export class PreferencesSearchProvider {
const workbenchSettings = this.configurationService.getConfiguration<IWorkbenchSettingsConfiguration>().workbench.settings;
return {
urlBase: workbenchSettings.experimentalFuzzySearchEndpoint,
key: workbenchSettings.experimentalFuzzySearchKey
key: workbenchSettings.experimentalFuzzySearchKey,
boost: workbenchSettings.experimentalFuzzySearchBoost
};
}
......@@ -196,7 +198,8 @@ function escapeSpecialChars(query: string): string {
function prepareUrl(query: string, endpoint: IEndpointDetails): string {
query = escapeSpecialChars(query);
const userQuery = query;
const boost = endpoint.boost || 1;
const userQuery = `(${query})^${boost}`;
// Appending Fuzzy after each word.
query = query.replace(/\ +/g, '~ ') + '~';
......
......@@ -22,6 +22,7 @@ export interface IWorkbenchSettingsConfiguration {
openDefaultSettings: boolean;
experimentalFuzzySearchEndpoint: string;
experimentalFuzzySearchKey: string;
experimentalFuzzySearchBoost: number;
}
};
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册