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.

SynonymMap model should take IEnumerable<string> for synonyms

See original GitHub issue

The generated model for SynonymMap takes a single string for synonyms, which the user would then have to pass with newlines embedded. This “magic formula” approach is something we try to avoid and just make it obvious and idiomatic. Guidelines recommend instead taking an IEnumerable<string> for the parameter and perhaps define the property as an IList<string> to allow adding to it. The de/serializer should handle splitting and joining with newlines accordingly.

/cc @brjohnstmsft

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
brjohnstmsftcommented, Mar 20, 2020

Talked with @Yahnoosh about this. Here’s the summary:

  • Synonym maps are usually authored as text files, and often imported from another system.
  • The REST API documentation is misleading about newline always being the separator – that actually depends on the format. For now, we only support the SOLR format, and newline is the delimiter for that format.
  • Stream makes sense as a way to ingest synonym map files on Create/CreateOrUpdate. However, the single-string property in the SynonymMap object should also be an option, if for no other reasons that demos/samples and the Get/List APIs.

Please let me know if you have any questions.

0reactions
brjohnstmsftcommented, Mar 21, 2020

@heaths Having a constructor that takes a Stream or TextReader makes sense. I think it’s a pretty safe assumption that it will always be text, so TextReader is probably fine.

Taking format as a parameter is problematic right now because there is only one allowable value (it should be an enum and not a string BTW). We hide it in Track 1 because it’s pointless for users to have to pass the same value all the time. If we can add it as an additional parameter (or constructor overload) later, IMO we can leave it out for now.

I would actually question the value of the third constructor rather than the second. If the map isn’t coming from a file, it’s probably being pasted from somewhere else. Constructing it programmatically line-by-line is useful for samples, but that’s about it. CC @Yahnoosh who can back me up on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SynonymMap model should take IEnumerable<string> for ...
The generated model for SynonymMap takes a single string for synonyms, which the user would then have to pass with newlines embedded.
Read more >
13 Synonyms & Antonyms for ROLE MODEL
synonyms for role model · example · exemplar · good example · hero · heroine · idol · mentor · superstar ...
Read more >
134 Synonyms & Antonyms for MODEL
synonyms for model · exemplary · miniature · classic · classical · copy · dummy · facsimile · imitation ...
Read more >
40 Synonyms & Antonyms for BASED ON
synonyms for based on · entrenched · fixed · established · firm · grounded · deep.
Read more >
13 Synonyms & Antonyms for PERSON TO LOOK UP TO
synonyms for person to look up to · epitome · exemplar · good example · ideal · ideal beauty · model · nonpareil...
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