Documentation
¶
Overview ¶
Package autocomplete provides domain types and logic for URL autocompletion.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeCompletionSuffix ¶
ComputeCompletionSuffix returns the suffix if input is a case-insensitive prefix of fullText. Returns the suffix and true if input matches as a prefix, otherwise empty string and false.
func ComputeURLCompletionSuffix ¶
ComputeURLCompletionSuffix computes the completion suffix for URLs, handling protocol stripping for better matching. It tries matching with and without protocol prefixes.
func StripProtocol ¶
StripProtocol removes http:// or https:// prefix from a URL for matching.
Types ¶
type Suggestion ¶
type Suggestion struct {
FullText string // The complete text (URL or bang shortcut)
Suffix string // The suffix to append after the user's input
Source SuggestionSource // Where this suggestion came from
Title string // Display title (page title or description)
}
Suggestion represents a single autocomplete suggestion with its completion suffix.
type SuggestionSource ¶
type SuggestionSource int
SuggestionSource indicates the origin of an autocomplete suggestion.
const ( SourceHistory SuggestionSource = iota SourceFavorite SourceBangShortcut )