Create Index does not preserve the "analyzer" property.
See original GitHub issue- @azure/search-documents
- 11.1.0
- macOS Big Sur 11.2.2
- nodejs
- v12.21.0:
- browser
- name/version:
- typescript
- version:
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug
I altered the example below adding analyzer: "en.microsoft"
to the description field of the index object. When I viewed the index in the portal the analyzer was not set on description field.
To Reproduce Steps to reproduce the behavior:
- Add the
analyzer: "en.microsoft"
the the example code above. Either review the results of the api call or view the index in the portal.
Expected behavior Analyzer property should be set.
Screenshots
Changes to the example code:
Index being sent to the api:
Results from the api call (analyzer is set to null):
Additional context I’ve also used the same index and posted it via postman and analyzer is properly set.
After some additional debugging I believe the function below is the culprit.
function convertFieldsToGenerated(fields) {
return fields.map((field) => {
var _a, _b, _c, _d;
if (isComplexField(field)) {
return field;
}
else {
const { hidden } = field, restField = tslib.__rest(field, ["hidden"]);
const retrievable = typeof hidden === "boolean" ? !hidden : hidden;
return Object.assign(Object.assign({}, restField), { retrievable,
// modify API defaults to use less storage for simple types
searchable: (_a = field.searchable) !== null && _a !== void 0 ? _a : false, filterable: (_b = field.filterable) !== null && _b !== void 0 ? _b : false, facetable: (_c = field.facetable) !== null && _c !== void 0 ? _c : false, sortable: (_d = field.sortable) !== null && _d !== void 0 ? _d : false, analyzer: field.analyzerName, searchAnalyzer: field.searchAnalyzerName, indexAnalyzer: field.indexAnalyzerName, synonymMaps: field.synonymMapNames });
}
});
}
analyzer: field.analyzerName
The field object does not have an ‘analyzerName’ property.
I believe the code should be:
analyzer: field.analyzer
Additional Notes
If you change the property name to analyzerName: "en.microsoft"
it works as expected but every where in the documentation the field is called analyzer
.
The analyzer
property works as expected on properties inside a Collection(Edm.ComplexType).
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
Thanks @scott-alvis. I will check and update the code for the July release. The code merge should be completed this week.
The documentation has been updated. Closing this issue