Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Score = Int
- type Scorer = Text -> Text -> Ratio Int
- newtype Match score entry = Match (score, entry)
- newtype QuickSearch uid = QuickSearch ([Entry Text uid], HashMap Token (HashSet uid))
- scoreMatches :: (Hashable uid, Eq uid) => Text -> QuickSearch uid -> Scorer -> [Match Score (Entry Text uid)]
- matchScore :: Match Score (Entry name uid) -> Score
- matchEntry :: Match Score (Entry name uid) -> Entry name uid
- quickSearchEntries :: (Hashable uid, Eq uid) => QuickSearch uid -> [Entry Text uid]
- quickSearchTokenFilter :: (Hashable uid, Eq uid) => QuickSearch uid -> HashMap Token (HashSet uid)
Documentation
newtype Match score entry Source #
Structure associating a Score with an Entry, for holding search results
Match (score, entry) |
newtype QuickSearch uid Source #
List of entries to be searched and a HashMap associating tokens with HashSets of UIDs related to entries containing the tokens.
Instances
Show uid => Show (QuickSearch uid) Source # | |
Defined in QuickSearch.Internal.Matcher showsPrec :: Int -> QuickSearch uid -> ShowS # show :: QuickSearch uid -> String # showList :: [QuickSearch uid] -> ShowS # |
:: (Hashable uid, Eq uid) | |
=> Text | Name or other string to be searched |
-> QuickSearch uid | The QuickSearch object to be used |
-> Scorer | A string distance function of type (Text -> Text -> Ratio Int) |
-> [Match Score (Entry Text uid)] | A list of possible matches |
Ignore the linter here, this is a performance thing
Given a string to search, a QuickSearch object, and a similarity function, returns potential matches contained in the QuickSearch filters and their associated scores, in descending order by score.
quickSearchEntries :: (Hashable uid, Eq uid) => QuickSearch uid -> [Entry Text uid] Source #
- Entry name uid
- accessor for QuickSearch
quickSearchTokenFilter :: (Hashable uid, Eq uid) => QuickSearch uid -> HashMap Token (HashSet uid) Source #
tokenFilter accessor for QuickSearch