question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create Index does not preserve the "analyzer" property.

See original GitHub issue

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.

Example Code https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/search/search-documents/samples/javascript/src/indexes/createIndex.js

To Reproduce Steps to reproduce the behavior:

  1. 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:

Screen Shot 2021-05-28 at 3 09 31 PM

Index being sent to the api:

Screen Shot 2021-05-28 at 2 22 00 PM

Results from the api call (analyzer is set to null):

Screen Shot 2021-05-28 at 2 22 43 PM

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
Screen Shot 2021-05-28 at 3 01 07 PM

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:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sarangan12commented, Jun 7, 2021

Thanks @scott-alvis. I will check and update the code for the July release. The code merge should be completed this week.

0reactions
sarangan12commented, Jul 9, 2021

The documentation has been updated. Closing this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Index configuration - Operations Manual - Neo4j
This page describes how to configure Neo4j indexes to enhance search performance and enable full-text search. The supported index types are: ... All...
Read more >
Create or Update Index (Preview REST API)
When a new field is added, all existing documents in the index automatically have a null value for that field. No additional storage...
Read more >
How to reset the index and convert the index to a column?
pandas.reset_index in Python is used to reset the current index of a dataframe to default indexing (0 to number of rows minus 1)...
Read more >
Specify an analyzer | Elasticsearch Guide [8.5] | Elastic
When creating an index, you can set a default search analyzer using the analysis.analyzer.default_search setting. If a search analyzer is provided, a default ......
Read more >
Indexes | Cloud Datastore Documentation
If you know you will never have to filter or sort on a particular property, you can tell your Datastore mode database not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found