Name-QuickSearch-0.2.0.0
Safe HaskellNone
LanguageHaskell2010

QuickSearch.Internal.Matcher

Synopsis

Documentation

type Score = Int Source #

newtype Match score entry Source #

Structure associating a Score with an Entry, for holding search results

Constructors

Match (score, entry) 

Instances

Instances details
Bifunctor Match Source # 
Instance details

Defined in QuickSearch.Internal.Matcher

Methods

bimap :: (a -> b) -> (c -> d) -> Match a c -> Match b d #

first :: (a -> b) -> Match a c -> Match b c #

second :: (b -> c) -> Match a b -> Match a c #

(Eq score, Eq entry) => Eq (Match score entry) Source # 
Instance details

Defined in QuickSearch.Internal.Matcher

Methods

(==) :: Match score entry -> Match score entry -> Bool #

(/=) :: Match score entry -> Match score entry -> Bool #

(Show score, Show entry) => Show (Match score entry) Source # 
Instance details

Defined in QuickSearch.Internal.Matcher

Methods

showsPrec :: Int -> Match score entry -> ShowS #

show :: Match score entry -> String #

showList :: [Match score entry] -> ShowS #

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.

Constructors

QuickSearch ([Entry Text uid], HashMap Token (HashSet uid)) 

Instances

Instances details
Show uid => Show (QuickSearch uid) Source # 
Instance details

Defined in QuickSearch.Internal.Matcher

Methods

showsPrec :: Int -> QuickSearch uid -> ShowS #

show :: QuickSearch uid -> String #

showList :: [QuickSearch uid] -> ShowS #

scoreMatches Source #

Arguments

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

matchScore :: Match Score (Entry name uid) -> Score Source #

Score accessor for Match

matchEntry :: Match Score (Entry name uid) -> Entry name uid Source #

Entry accessor for Match

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