Make suggestion limit configurable and remove redundant .take(10) from widget

Move hardcoded suggestion limit to kNSIMaxSuggestions in dev_config, and remove
the redundant .take(10) from optionsBuilder since the fetch stage already caps
results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Doug Borg
2026-02-09 14:32:18 -07:00
parent ef6fc1c9c8
commit ef4205f4bd
3 changed files with 4 additions and 7 deletions

View File

@@ -144,6 +144,7 @@ const int kDefaultMaxNodes = 500; // Default maximum number of nodes to render o
// NSI (Name Suggestion Index) configuration
const int kNSIMinimumHitCount = 500; // Minimum hit count for NSI suggestions to be considered useful
const int kNSIMaxSuggestions = 10; // Maximum number of tag value suggestions to fetch and display
// Map interaction configuration
const double kNodeDoubleTapZoomDelta = 1.0; // How much to zoom in when double-tapping nodes (was 1.0)

View File

@@ -84,8 +84,7 @@ class NSIService {
}
}
// Limit to top 10 suggestions for UI performance
if (suggestions.length >= 10) break;
if (suggestions.length >= kNSIMaxSuggestions) break;
}
return suggestions;

View File

@@ -110,12 +110,9 @@ class _NSITagValueFieldState extends State<NSITagValueField> {
focusNode: _focusNode,
optionsBuilder: (TextEditingValue textEditingValue) {
if (_suggestions.isEmpty) return const Iterable<String>.empty();
if (textEditingValue.text.isEmpty) {
return _suggestions.take(10);
}
if (textEditingValue.text.isEmpty) return _suggestions;
return _suggestions
.where((s) => s.contains(textEditingValue.text))
.take(10);
.where((s) => s.contains(textEditingValue.text));
},
onSelected: (String selection) {
widget.onChanged(selection);