Skip to content

Commit 16e9c9e

Browse files
authored
chore(indexes): add help text for index type COMPASS-7591 (#7416)
add help text for index type=text
1 parent 0593442 commit 16e9c9e

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

packages/compass-e2e-tests/helpers/commands/create-index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const indexTypeToIndexSelectOption: Record<IndexType, string> = {
1818
'1': '1 (asc)',
1919
'-1': '-1 (desc)',
2020
'2dsphere': '2dsphere',
21-
text: 'text',
21+
text: 'text (full text search)',
2222
};
2323

2424
export async function createIndex(

packages/compass-indexes/src/components/create-index-fields.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ import { useTelemetry } from '@mongodb-js/compass-telemetry/provider';
1818
/**
1919
* Current allowed types for indexes.
2020
*/
21-
const INDEX_TYPES = ['1 (asc)', '-1 (desc)', '2dsphere', 'text', 'columnstore'];
21+
const INDEX_TYPES = [
22+
'1 (asc)',
23+
'-1 (desc)',
24+
'2dsphere',
25+
'text (full text search)',
26+
'columnstore',
27+
];
2228

2329
/**
2430
* Default values for field name and type as presented in the UI.
@@ -96,7 +102,7 @@ function CreateIndexFields({
96102
track('New Index Field Added', {
97103
context: 'Create Index Modal',
98104
});
99-
}, [onAddFieldClick]);
105+
}, [onAddFieldClick, track]);
100106

101107
const comboboxOptions = schemaFields.map((value) => ({ value }));
102108

packages/compass-indexes/src/modules/create-index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('create-index module', function () {
2626
describe('#createIndexFormSubmitted', function () {
2727
beforeEach(function () {
2828
store.dispatch(updateFieldName(0, 'foo'));
29-
store.dispatch(fieldTypeUpdated(0, 'text'));
29+
store.dispatch(fieldTypeUpdated(0, 'text (full text search)'));
3030
});
3131

3232
it('validates collation', function () {

packages/compass-indexes/src/modules/create-index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,10 @@ function fieldTypeToIndexDirection(type: string): IndexDirection {
540540
if (type === '-1 (desc)') {
541541
return -1;
542542
}
543-
if (type === 'text' || type === '2dsphere') {
543+
if (type === 'text (full text search)') {
544+
return 'text';
545+
}
546+
if (type === '2dsphere') {
544547
return type;
545548
}
546549
throw new Error(`Unsupported field type: ${type}`);

0 commit comments

Comments
 (0)