Skip to content

Commit c554c4f

Browse files
committed
Added symbols_to_index configuration available since Typesense 0.22.0
1 parent 3040d98 commit c554c4f

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ acseo_typesense:
8383
type: datetime
8484
optional: true # Declare field as optional
8585
default_sorting_field: sortable_id # Default sorting field. Must be int32 or float
86+
symbols_to_index: ['+'] # Optional - You can add + to this list to make the word c++ indexable verbatim.
8687
users:
8788
entity: App\Entity\User
8889
fields:

src/Client/CollectionClient.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function list()
5858
return $this->client->collections->retrieve();
5959
}
6060

61-
public function create($name, $fields, $defaultSortingField, array $tokenSeparators)
61+
public function create($name, $fields, $defaultSortingField, array $tokenSeparators, array $symbolsToIndex)
6262
{
6363
if (!$this->client->isOperationnal()) {
6464
return null;
@@ -69,6 +69,7 @@ public function create($name, $fields, $defaultSortingField, array $tokenSeparat
6969
'fields' => $fields,
7070
'default_sorting_field' => $defaultSortingField,
7171
'token_separators' => $tokenSeparators,
72+
'symbols_to_index' => $symbolsToIndex
7273
]);
7374
}
7475

src/DependencyInjection/ACSEOTypesenseExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ private function loadCollections(array $collections, ContainerBuilder $container
129129
'fields' => $config['fields'],
130130
'default_sorting_field' => $config['default_sorting_field'],
131131
'token_separators' => $config['token_separators'],
132+
'symbols_to_index' => $config['symbols_to_index'],
132133
];
133134
}
134135
}

src/DependencyInjection/Configuration.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public function getConfigTreeBuilder(): TreeBuilder
5757
->defaultValue([])
5858
->scalarPrototype()->end()
5959
->end()
60+
->arrayNode('symbols_to_index')
61+
->defaultValue([])
62+
->scalarPrototype()->end()
63+
->end()
6064
->end()
6165
->end()
6266
->end()

src/Manager/CollectionManager.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ public function createCollection($collectionDefinitionName)
6363
$fields[] = $fieldDefinition;
6464
}
6565

66-
//For passing tests
66+
//to pass the tests
6767
$tokenSeparators = array_key_exists('token_separators', $definition) ? $definition['token_separators'] : [];
68+
$symbolsToIndex = array_key_exists('symbols_to_index', $definition) ? $definition['symbols_to_index'] : [];
6869

6970
$this->collectionClient->create(
7071
$definition['typesense_name'],
7172
$fields,
7273
$definition['default_sorting_field'],
73-
$tokenSeparators
74+
$tokenSeparators,
75+
$symbolsToIndex
7476
);
7577
}
7678
}

0 commit comments

Comments
 (0)