search

package
v0.0.0-...-5203d79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2013 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

vim:ts=4:sw=4:noexpandtab

vim:ts=4:sw=4:noexpandtab

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenTimingFiles

func OpenTimingFiles() (err error)

func RewriteQuery

func RewriteQuery(u url.URL) url.URL

Parses the querystring (q= parameter) and moves special tokens such as "lang:c" from the querystring into separate arguments.

func Search(w http.ResponseWriter, r *http.Request)

Types

type Match

type Match struct {
	// These members are filled in by the source backend.
	// NB: I would love to use dcs/regexp.Match as an anonymous struct here,
	// but encoding/json has a bug: It ignores anonymous struct fields when
	// decoding/encoding (it’s documented :-/).
	Path    string
	Line    int
	Ctxp2   string
	Ctxp1   string
	Context string
	Ctxn1   string
	Ctxn2   string
	Ranking float32

	// These are filled in by Prettify()
	SourcePackage string
	RelativePath  string

	// The ranking of the ResultPath corresponding to Path
	PathRanking float32

	// The combined Ranking * PathRanking
	FinalRanking float32
}

This Match data structure is filled when receiving the match from the source backend. It is then enriched with the ranking of the corresponding path and displayed to the user.

func (*Match) Prettify

func (m *Match) Prettify()

type SearchResults

type SearchResults []Match

This type implements sort.Interface so that we can sort it by rank.

func (SearchResults) Len

func (s SearchResults) Len() int

func (SearchResults) Less

func (s SearchResults) Less(i, j int) bool

func (SearchResults) Swap

func (s SearchResults) Swap(i, j int)

type SourceReply

type SourceReply struct {
	// The number of the last used filename, needed for pagination
	LastUsedFilename int

	AllMatches []Match
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL