Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lines ¶ added in v0.2.0
type Lines []Line
Lines is an array of Line. It is used as typing information for the Go template.
type ShakeSearcher ¶
type ShakeSearcher struct {
// contains filtered or unexported fields
}
ShakeSearcher is the data structure that holds the unique lines of Shakespeare's complete works in a convent format to search. The format is a map of all lines and a slice of the line numbers they belong to.
func NewShakeSearcher ¶
func NewShakeSearcher(filePath string) (shakeSearcher *ShakeSearcher, err error)
NewShakeSearcher loads the give file as a slice of string with trimmed space.
func (*ShakeSearcher) Search ¶
func (s *ShakeSearcher) Search(maxMatches int, query string) (results []*models.Result)
Search does a fuzzy search of the complete works of Shakespeare and returns a slice of results with a length less than or equal to the maxMatches. A maxMatches with a value of -1 will return all matches.
func (*ShakeSearcher) SurroundingWorks ¶ added in v0.2.0
func (s *ShakeSearcher) SurroundingWorks(lineNumber int, maxLines uint) (lines Lines)
SurroundingWorks retrieves the line numbers surrounding the given line. The number of lines returned will be less than or equal to maxLines.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package restapi shakesearch A ProlificLabs take-home challenge.
|
Package restapi shakesearch A ProlificLabs take-home challenge. |