camlistore: github.com/rfistman/camlistore/pkg/search Index | Files

package search

import "github.com/rfistman/camlistore/pkg/search"

Package search describes and answers Camlistore search queries.

Many of the search methods or functions provide results that are ordered by modification time, or at least depend on modification times. In that context, (un)deletions (of permanodes, or attributes) are not considered modifications and therefore the time at which they occured does not affect the result.

Index

Package Files

describe.go expr.go handler.go lexer.go predicate.go query.go search.go websocket.go

Constants

const MaxImageSize = 2000

MaxImageSize is the maximum width or height in pixels that we will serve image thumbnails at. It is used in the search result UI.

func SearchHelp Uses

func SearchHelp() string

SearchHelp returns JSON of an array of predicate names and descriptions.

type ClaimConstraint Uses

type ClaimConstraint struct {
    SignedBy     string    `json:"signedBy"` // identity
    SignedAfter  time.Time `json:"signedAfter"`
    SignedBefore time.Time `json:"signedBefore"`
}

type ClaimsItem Uses

type ClaimsItem struct {
    BlobRef   blob.Ref       `json:"blobref"`
    Signer    blob.Ref       `json:"signer"`
    Permanode blob.Ref       `json:"permanode"`
    Date      types.Time3339 `json:"date"`
    Type      string         `json:"type"`
    Attr      string         `json:"attr,omitempty"`
    Value     string         `json:"value,omitempty"`
}

A ClaimsItem is an item returned from $searchRoot/camli/search/claims.

type ClaimsRequest Uses

type ClaimsRequest struct {
    Permanode blob.Ref

    // AttrFilter optionally filters claims about the given attribute.
    // If empty, all claims for the given Permanode are returned.
    AttrFilter string
}

ClaimsRequest is a request to get a ClaimsResponse.

func (*ClaimsRequest) URLSuffix Uses

func (r *ClaimsRequest) URLSuffix() string

type ClaimsResponse Uses

type ClaimsResponse struct {
    Claims []*ClaimsItem `json:"claims"`
}

ClaimsResponse is the JSON response from $searchRoot/camli/search/claims.

type Constraint Uses

type Constraint struct {
    // If Logical is non-nil, all other fields are ignored.
    Logical *LogicalConstraint `json:"logical,omitempty"`

    // Anything, if true, matches all blobs.
    Anything bool `json:"anything,omitempty"`

    CamliType     string `json:"camliType,omitempty"`    // camliType of the JSON blob
    AnyCamliType  bool   `json:"anyCamliType,omitempty"` // if true, any camli JSON blob matches
    BlobRefPrefix string `json:"blobRefPrefix,omitempty"`

    File *FileConstraint `json:"file,omitempty"`
    Dir  *DirConstraint  `json:"dir,omitempty"`

    Claim    *ClaimConstraint `json:"claim,omitempty"`
    BlobSize *IntConstraint   `json:"blobSize,omitempty"`

    Permanode *PermanodeConstraint `json:"permanode,omitempty"`
    // contains filtered or unexported fields
}

Constraint specifies a blob matching constraint. A blob matches if it matches all non-zero fields' predicates. A zero constraint matches nothing.

type DescribeError Uses

type DescribeError map[string]error

func (DescribeError) Error Uses

func (de DescribeError) Error() string

type DescribeRequest Uses

type DescribeRequest struct {
    // BlobRefs are the blobs to describe. If length zero, BlobRef
    // is used.
    BlobRefs []blob.Ref `json:"blobrefs,omitempty"`

    // BlobRef is the blob to describe.
    BlobRef blob.Ref `json:"blobref,omitempty"`

    // Depth is the optional traversal depth to describe from the
    // root BlobRef. If zero, a default is used.
    // Depth is deprecated and will be removed. Use Rules instead.
    Depth int `json:"depth,omitempty"`

    // MaxDirChildren is the requested optional limit to the number
    // of children that should be fetched when describing a static
    // directory. If zero, a default is used.
    MaxDirChildren int `json:"maxDirChildren,omitempty"`

    // At specifies the time which we wish to see the state of
    // this blob.  If zero (unspecified), all claims will be
    // considered, otherwise, any claims after this date will not
    // be considered.
    At  types.Time3339 `json:"at"`

    // Rules specifies a set of rules to instruct how to keep
    // expanding the described set. All rules are tested and
    // matching rules grow the the response set until all rules no
    // longer match or internal limits are hit.
    Rules []*DescribeRule `json:"rules,omitempty"`
    // contains filtered or unexported fields
}

func (*DescribeRequest) Describe Uses

func (dr *DescribeRequest) Describe(br blob.Ref, depth int)

Describe starts a lookup of br, down to the provided depth. It returns immediately.

func (*DescribeRequest) DescribeSync Uses

func (dr *DescribeRequest) DescribeSync(br blob.Ref) (*DescribedBlob, error)

func (*DescribeRequest) DescribedBlobStr Uses

func (dr *DescribeRequest) DescribedBlobStr(blobstr string) *DescribedBlob

Given a blobref string returns a Description or nil. dr may be nil itself.

func (*DescribeRequest) Result Uses

func (dr *DescribeRequest) Result() (desmap map[string]*DescribedBlob, err error)

Result waits for all outstanding lookups to complete and returns the map of blobref (strings) to their described results. The returned error is non-nil if any errors occured, and will be of type DescribeError.

func (*DescribeRequest) URLSuffix Uses

func (r *DescribeRequest) URLSuffix() string

URLSuffix returns the URL suffix for GET requests. This is deprecated.

func (*DescribeRequest) URLSuffixPost Uses

func (r *DescribeRequest) URLSuffixPost() string

URLSuffixPost returns the URL suffix for POST requests.

type DescribeResponse Uses

type DescribeResponse struct {
    Meta MetaMap `json:"meta"`
}

DescribeResponse is the JSON response from $searchRoot/camli/search/describe.

type DescribeRule Uses

type DescribeRule struct {

    // IsResultRoot, if true, only matches if the blob was part of
    // the original search results, not a blob expanded later.
    IfResultRoot bool `json:"ifResultRoot,omitempty"`

    // IfCamliNodeType matches if the "camliNodeType" attribute
    // equals this value.
    IfCamliNodeType string `json:"ifCamliNodeType,omitempty"`

    // Attrs lists attributes to describe. A special case
    // is if the value ends in "*", which matches prefixes
    // (e.g. "camliPath:*" or "*").
    Attrs []string `json:"attrs,omitempty"`

    // Additional rules to run on the described results of Attrs.
    Rules []*DescribeRule `json:"rules,omitempty"`
    // contains filtered or unexported fields
}

type DescribedBlob Uses

type DescribedBlob struct {
    Request *DescribeRequest `json:"-"`

    BlobRef   blob.Ref `json:"blobRef"`
    CamliType string   `json:"camliType,omitempty"`
    Size      int64    `json:"size,"`

    // if camliType "permanode"
    Permanode *DescribedPermanode `json:"permanode,omitempty"`

    // if camliType "file"
    File *camtypes.FileInfo `json:"file,omitempty"`
    // if camliType "directory"
    Dir *camtypes.FileInfo `json:"dir,omitempty"`
    // if camliType "file", and File.IsImage()
    Image *camtypes.ImageInfo `json:"image,omitempty"`
    // if camliType "file" and media file
    MediaTags map[string]string `json:"mediaTags,omitempty"`

    // if camliType "directory"
    DirChildren []blob.Ref `json:"dirChildren,omitempty"`

    // Stub is set if this is not loaded, but referenced.
    Stub bool `json:"-"`
}

func (*DescribedBlob) ContentRef Uses

func (b *DescribedBlob) ContentRef() (br blob.Ref, ok bool)

func (*DescribedBlob) Description Uses

func (b *DescribedBlob) Description() string

func (*DescribedBlob) DirMembers Uses

func (b *DescribedBlob) DirMembers() []*DescribedBlob

func (*DescribedBlob) DomID Uses

func (b *DescribedBlob) DomID() string

func (*DescribedBlob) Members Uses

func (b *DescribedBlob) Members() []*DescribedBlob

Members returns all of b's children, as given by b's camliMember and camliPath:* attributes. Only the first entry for a given camliPath attribute is used.

func (*DescribedBlob) PeerBlob Uses

func (b *DescribedBlob) PeerBlob(br blob.Ref) *DescribedBlob

PeerBlob returns a DescribedBlob for the provided blobref.

Unlike DescribedBlobStr, the returned DescribedBlob is never nil.

If the blob was never loaded along with the the receiver (or if the receiver is nil), a stub DescribedBlob is returned with its Stub field set true.

func (*DescribedBlob) PermanodeDir Uses

func (b *DescribedBlob) PermanodeDir() (path []blob.Ref, fi *camtypes.FileInfo, ok bool)

PermanodeDir returns in path the blobref of the described permanode and the blobref of its Directory camliContent. If b isn't a permanode, or doesn't have a camliContent that is a directory blob, ok is false.

func (*DescribedBlob) PermanodeFile Uses

func (b *DescribedBlob) PermanodeFile() (path []blob.Ref, fi *camtypes.FileInfo, ok bool)

PermanodeFile returns in path the blobref of the described permanode and the blobref of its File camliContent. If b isn't a permanode, or doesn't have a camliContent that is a file blob, ok is false.

func (*DescribedBlob) Title Uses

func (b *DescribedBlob) Title() string

type DescribedPermanode Uses

type DescribedPermanode struct {
    Attr    url.Values `json:"attr"` // a map[string][]string
    ModTime time.Time  `json:"modtime,omitempty"`
}

func (*DescribedPermanode) IsContainer Uses

func (dp *DescribedPermanode) IsContainer() bool

IsContainer returns whether the permanode has either named ("camliPath:"-prefixed) or unnamed ("camliMember") member attributes.

type DirConstraint Uses

type DirConstraint struct {
    FileName *StringConstraint

    TopFileSize,
    TopFileCount,
    FileSize,
    FileCount *IntConstraint
}

type EXIFConstraint Uses

type EXIFConstraint struct {
}

type EdgeItem Uses

type EdgeItem struct {
    From     blob.Ref `json:"from"`
    FromType string   `json:"fromType"`
}

An EdgeItem is an item returned from $searchRoot/camli/search/edgesto.

type EdgesRequest Uses

type EdgesRequest struct {
    // The blob we want to find as a reference.
    ToRef blob.Ref
}

EdgesRequest is a request to get an EdgesResponse.

type EdgesResponse Uses

type EdgesResponse struct {
    ToRef   blob.Ref    `json:"toRef"`
    EdgesTo []*EdgeItem `json:"edgesTo"`
}

EdgesResponse is the JSON response from $searchRoot/camli/search/edgesto.

type FileConstraint Uses

type FileConstraint struct {
    FileSize *IntConstraint    `json:"fileSize,omitempty"`
    FileName *StringConstraint `json:"fileName,omitempty"`
    MIMEType *StringConstraint `json:"mimeType,omitempty"`
    Time     *TimeConstraint   `json:"time,omitempty"`
    ModTime  *TimeConstraint   `json:"modTime,omitempty"`

    // WholeRef if non-zero only matches if the entire checksum of the
    // file (the concatenation of all its blobs) is equal to the
    // provided blobref. The index may not have every file's digest for
    // every known hash algorithm.
    WholeRef blob.Ref `json:"wholeRef,omitempty"`

    // For images:
    IsImage  bool                `json:"isImage,omitempty"`
    EXIF     *EXIFConstraint     `json:"exif,omitempty"` // TODO: implement
    Width    *IntConstraint      `json:"width,omitempty"`
    Height   *IntConstraint      `json:"height,omitempty"`
    WHRatio  *FloatConstraint    `json:"widthHeightRation,omitempty"`
    Location *LocationConstraint `json:"location,omitempty"`

    // MediaTag is for ID3 (and similar) embedded metadata in files.
    MediaTag *MediaTagConstraint `json:"mediaTag,omitempty"`
}

type FloatConstraint Uses

type FloatConstraint struct {
    // Min and Max are both optional and inclusive bounds.
    // Zero means don't check.
    Min     float64 `json:"min,omitempty"`
    Max     float64 `json:"max,omitempty"`
    ZeroMin bool    `json:"zeroMin,omitempty"` // if true, min is actually zero
    ZeroMax bool    `json:"zeroMax,omitempty"` // if true, max is actually zero
}

A FloatConstraint specifies constraints on a float.

type GetRecentPermanoder Uses

type GetRecentPermanoder interface {
    // GetRecentPermanodes returns recently-modified permanodes.
    // This is a higher-level query returning more metadata than the index.GetRecentPermanodes,
    // which only scans the blobrefs but doesn't return anything about the permanodes.
    GetRecentPermanodes(*RecentRequest) (*RecentResponse, error)
}

GetRecentPermanoder is the interface containing the GetRecentPermanodes method.

type Handler Uses

type Handler struct {
    // contains filtered or unexported fields
}

Handler handles search queries.

func NewHandler Uses

func NewHandler(index index.Interface, owner blob.Ref) *Handler

func (*Handler) Describe Uses

func (sh *Handler) Describe(dr *DescribeRequest) (dres *DescribeResponse, err error)

func (*Handler) EdgesTo Uses

func (sh *Handler) EdgesTo(req *EdgesRequest) (*EdgesResponse, error)

EdgesTo returns edges that reference req.RefTo. It filters out since-deleted permanode edges.

func (*Handler) GetClaims Uses

func (sh *Handler) GetClaims(req *ClaimsRequest) (*ClaimsResponse, error)

GetClaims returns the claims on req.Permanode signed by sh.owner.

func (*Handler) GetPermanodesWithAttr Uses

func (sh *Handler) GetPermanodesWithAttr(req *WithAttrRequest) (*WithAttrResponse, error)

GetPermanodesWithAttr returns permanodes with attribute req.Attr having the req.Value as a value. See WithAttrRequest for more details about the query.

func (*Handler) GetRecentPermanodes Uses

func (sh *Handler) GetRecentPermanodes(req *RecentRequest) (*RecentResponse, error)

GetRecentPermanodes returns recently-modified permanodes.

func (*Handler) GetSignerPaths Uses

func (sh *Handler) GetSignerPaths(req *SignerPathsRequest) (*SignerPathsResponse, error)

GetSignerPaths returns paths with a target of req.Target.

func (*Handler) Index Uses

func (h *Handler) Index() index.Interface

func (*Handler) NewDescribeRequest Uses

func (sh *Handler) NewDescribeRequest() *DescribeRequest

NewDescribeRequest returns a new DescribeRequest holding the state of blobs and their summarized descriptions. Use DescribeBlob one or more times before calling Result.

func (*Handler) Owner Uses

func (h *Handler) Owner() blob.Ref

Owner returns Handler owner's public key blobref.

func (*Handler) Query Uses

func (h *Handler) Query(rawq *SearchQuery) (*SearchResult, error)

func (*Handler) SendStatusUpdate Uses

func (h *Handler) SendStatusUpdate(status json.RawMessage)

SendStatusUpdate sends a JSON status map to any connected WebSocket clients.

func (*Handler) ServeHTTP Uses

func (sh *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*Handler) SetCorpus Uses

func (h *Handler) SetCorpus(c *index.Corpus)

type IntConstraint Uses

type IntConstraint struct {
    // Min and Max are both optional and inclusive bounds.
    // Zero means don't check.
    Min     int64 `json:"min,omitempty"`
    Max     int64 `json:"max,omitempty"`
    ZeroMin bool  `json:"zeroMin,omitempty"` // if true, min is actually zero
    ZeroMax bool  `json:"zeroMax,omitempty"` // if true, max is actually zero
}

An IntConstraint specifies constraints on an integer.

type LocationConstraint Uses

type LocationConstraint struct {
    // Any, if true, matches any photo with a known location.
    Any bool

    // North, West, East, and South define a region in which a photo
    // must be in order to match.
    North float64
    West  float64
    East  float64
    South float64
}

type LogicalConstraint Uses

type LogicalConstraint struct {
    Op  string      `json:"op"` // "and", "or", "xor", "not"
    A   *Constraint `json:"a"`
    B   *Constraint `json:"b"` // only valid if Op != "not"
}

type MediaTagConstraint Uses

type MediaTagConstraint struct {
    // Tag is the tag to match.
    // For ID3, this includes: title, artist, album, genre, musicbrainzalbumid, year, track, disc, mediaref, durationms.
    Tag string `json:"tag"`

    String *StringConstraint `json:"string,omitempty"`
    Int    *IntConstraint    `json:"int,omitempty"`
}

type MetaMap Uses

type MetaMap map[string]*DescribedBlob

A MetaMap is a map from blobref to a DescribedBlob.

func (MetaMap) Get Uses

func (m MetaMap) Get(br blob.Ref) *DescribedBlob

type PermanodeConstraint Uses

type PermanodeConstraint struct {
    // At specifies the time at which to pretend we're resolving attributes.
    // Attribute claims after this point in time are ignored.
    // If zero, the current time is used.
    At  time.Time `json:"at,omitempty"`

    // ModTime optionally matches on the last modtime of the permanode.
    ModTime *TimeConstraint `json:"modTime,omitempty"`

    // Time optionally matches the permanode's time. A Permanode
    // may not have a known time. If the permanode does not have a
    // known time, one may be guessed if the top-level search
    // parameters request so.
    Time *TimeConstraint `json:"time,omitempty"`

    // Attr optionally specifies the attribute to match.
    // e.g. "camliContent", "camliMember", "tag"
    // This is required if any of the items below are used.
    Attr string `json:"attr,omitempty"`

    // SkipHidden skips hidden or other boring files.
    SkipHidden bool `json:"skipHidden,omitempty"`

    // NumValue optionally tests the number of values this
    // permanode has for Attr.
    NumValue *IntConstraint `json:"numValue,omitempty"`

    // ValueAll modifies the matching behavior when an attribute
    // is multi-valued.  By default, when ValueAll is false, only
    // one value of a multi-valued attribute needs to match. If
    // ValueAll is true, all attributes must match.
    ValueAll bool `json:"valueAllMatch,omitempty"`

    // Value specifies an exact string to match.
    // This is a convenience form for the simple case of exact
    // equality. The same can be accomplished with ValueMatches.
    Value string `json:"value,omitempty"` // if non-zero, absolute match

    // ValueMatches optionally specifies a StringConstraint to
    // match the value against.
    ValueMatches *StringConstraint `json:"valueMatches,omitempty"`

    // ValueMatchesInt optionally specifies an IntConstraint to match
    // the value against. Non-integer values will not match.
    ValueMatchesInt *IntConstraint `json:"valueMatchesInt,omitempty"`

    // ValueMatchesFloat optionally specifies a FloatConstraint to match
    // the value against. Non-float values will not match.
    ValueMatchesFloat *FloatConstraint `json:"valueMatchesFloat,omitempty"`

    // ValueInSet optionally specifies a sub-query which the value
    // (which must be a blobref) must be a part of.
    ValueInSet *Constraint `json:"valueInSet,omitempty"`

    // Relation optionally specifies a constraint based on relations
    // to other permanodes (e.g. camliMember or camliPath sets).
    // You can use it to test the properties of a parent, ancestor,
    // child, or progeny.
    Relation *RelationConstraint `json:"relation,omitempty"`

    // Location optionally restricts matches to permanodes having
    // this location. This only affects permanodes with a known
    // type to have an lat/long location.
    Location *LocationConstraint `json:"location,omitempty"`

    // Continue is for internal use.
    Continue *PermanodeContinueConstraint `json:"-"`
}

PermanodeConstraint matches permanodes.

type PermanodeContinueConstraint Uses

type PermanodeContinueConstraint struct {
    // LastMod if non-zero is the modtime of the last item
    // that was seen. One of this or LastCreated will be set.
    LastMod time.Time

    // LastCreated if non-zero is the creation time of the last
    // item that was seen.
    LastCreated time.Time

    // Last is the last blobref that was shown at the time
    // given in ModLessEqual or CreateLessEqual.
    // This is used as a tie-breaker.
    // If the time is equal, permanodes <= this are not matched.
    // If the time is past this in the scroll position, then this
    // field is ignored.
    Last blob.Ref
}

type QueryDescriber Uses

type QueryDescriber interface {
    Query(*SearchQuery) (*SearchResult, error)
    Describe(*DescribeRequest) (*DescribeResponse, error)
}

type RecentItem Uses

type RecentItem struct {
    BlobRef blob.Ref       `json:"blobref"`
    ModTime types.Time3339 `json:"modtime"`
    Owner   blob.Ref       `json:"owner"`
}

A RecentItem is an item returned from $searchRoot/camli/search/recent in the "recent" list.

type RecentRequest Uses

type RecentRequest struct {
    N      int       // if zero, default number of results
    Before time.Time // if zero, now
}

RecentRequest is a request to get a RecentResponse.

func (*RecentRequest) URLSuffix Uses

func (r *RecentRequest) URLSuffix() string

type RecentResponse Uses

type RecentResponse struct {
    Recent []*RecentItem `json:"recent"`
    Meta   MetaMap       `json:"meta"`

    Error     string `json:"error,omitempty"`
    ErrorType string `json:"errorType,omitempty"`
}

RecentResponse is the JSON response from $searchRoot/camli/search/recent.

func (*RecentResponse) Err Uses

func (r *RecentResponse) Err() error

type RelationConstraint Uses

type RelationConstraint struct {
    // Relation must be one of:
    //   * "child"
    //   * "parent" (immediate parent only)
    //   * "progeny" (any level down)
    //   * "ancestor" (any level up)
    Relation string

    // EdgeType optionally specifies an edge type.
    // By default it matches "camliMember" and "camliPath:*".
    EdgeType string

    // After finding all the nodes matching the Relation and
    // EdgeType, either one or all (depending on whether Any or
    // All is set) must then match for the RelationConstraint
    // itself to match.
    //
    // It is an error to set both.
    Any, All *Constraint
}

type SearchQuery Uses

type SearchQuery struct {

    // Expression is a textual search query in minimal form,
    // e.g. "hawaii before:2008" or "tag:foo" or "foo" or "location:portland"
    // See expr.go and expr_test.go for all the operators.
    Expression string      `json:"expression,omitempty"`
    Constraint *Constraint `json:"constraint,omitempty"`

    // Limit is the maximum number of returned results. A negative value means no
    // limit. If unspecified, a default (of 200) will be used.
    Limit int `json:"limit,omitempty"`

    // Sort specifies how the results will be sorted. It defaults to CreatedDesc when the
    // query is about permanodes only.
    Sort SortType `json:"sort,omitempty"`

    // Around specifies that the results, after sorting, should be centered around
    // this result. If Around is not found the returned results will be empty.
    // If both Continue and Around are set, an error is returned.
    Around blob.Ref `json:"around,omitempty"`

    // Continue specifies the opaque token (as returned by a
    // SearchResult) for where to continue fetching results when
    // the Limit on a previous query was interrupted.
    // Continue is only valid for the same query (Expression or Constraint),
    // Limit, and Sort values.
    // If empty, the top-most query results are returned, as given
    // by Limit and Sort.
    // Continue is not compatible with the Around option.
    Continue string `json:"continue,omitempty"`

    // If Describe is specified, the matched blobs are also described,
    // as if the Describe.BlobRefs field was populated.
    Describe *DescribeRequest `json:"describe,omitempty"`
}

func (*SearchQuery) URLSuffix Uses

func (q *SearchQuery) URLSuffix() string

type SearchResult Uses

type SearchResult struct {
    Blobs    []*SearchResultBlob `json:"blobs"`
    Describe *DescribeResponse   `json:"description"`

    // Continue optionally specifies the continuation token to to
    // continue fetching results in this result set, if interrupted
    // by a Limit.
    Continue string `json:"continue,omitempty"`
}

SearchResult is the result of the Search method for a given SearchQuery.

type SearchResultBlob Uses

type SearchResultBlob struct {
    Blob blob.Ref `json:"blob"`
}

func (*SearchResultBlob) String Uses

func (r *SearchResultBlob) String() string

type SignerAttrValueResponse Uses

type SignerAttrValueResponse struct {
    Permanode blob.Ref `json:"permanode"`
    Meta      MetaMap  `json:"meta"`
}

SignerAttrValueResponse is the JSON response to $search/camli/search/signerattrvalue

type SignerPathsItem Uses

type SignerPathsItem struct {
    ClaimRef blob.Ref `json:"claimRef"`
    BaseRef  blob.Ref `json:"baseRef"`
    Suffix   string   `json:"suffix"`
}

A SignerPathsItem is an item returned from $searchRoot/camli/search/signerpaths.

type SignerPathsRequest Uses

type SignerPathsRequest struct {
    Signer blob.Ref
    Target blob.Ref
}

SignerPathsRequest is a request to get a SignerPathsResponse.

type SignerPathsResponse Uses

type SignerPathsResponse struct {
    Paths []*SignerPathsItem `json:"paths"`
    Meta  MetaMap            `json:"meta"`
}

SignerPathsResponse is the JSON response from $searchRoot/camli/search/signerpaths.

type SortType Uses

type SortType int
const (
    UnspecifiedSort SortType = iota
    Unsorted
    LastModifiedDesc
    LastModifiedAsc
    CreatedDesc
    CreatedAsc
    BlobRefAsc
)

func (SortType) MarshalJSON Uses

func (t SortType) MarshalJSON() ([]byte, error)

func (*SortType) UnmarshalJSON Uses

func (t *SortType) UnmarshalJSON(v []byte) error

type StringConstraint Uses

type StringConstraint struct {
    Empty           bool           `json:"empty,omitempty"` // matches empty string
    Equals          string         `json:"equals,omitempty"`
    Contains        string         `json:"contains,omitempty"`
    HasPrefix       string         `json:"hasPrefix,omitempty"`
    HasSuffix       string         `json:"hasSuffix,omitempty"`
    ByteLength      *IntConstraint `json:"byteLength,omitempty"` // length in bytes (not chars)
    CaseInsensitive bool           `json:"caseInsensitive,omitempty"`
}

A StringConstraint specifies constraints on a string. All non-zero must match.

type TimeConstraint Uses

type TimeConstraint struct {
    Before types.Time3339 `json:"before"` // <
    After  types.Time3339 `json:"after"`  // >=

    // TODO: this won't JSON-marshal/unmarshal well. Make a time.Duration marshal type?
    // Likewise with time that supports omitempty?
    InLast time.Duration `json:"inLast"` // >=
}

type WithAttrItem Uses

type WithAttrItem struct {
    Permanode blob.Ref `json:"permanode"`
}

A WithAttrItem is an item returned from $searchRoot/camli/search/permanodeattr.

type WithAttrRequest Uses

type WithAttrRequest struct {
    N      int      // max number of results
    Signer blob.Ref // if nil, will use the server's default owner (if configured)
    // Requested attribute. If blank, all attributes are searched (for Value)
    // as fulltext.
    Attr string
    // Value of the requested attribute. If blank, permanodes which have
    // request.Attr as an attribute are searched.
    Value string
    Fuzzy bool // fulltext search (if supported).
}

WithAttrRequest is a request to get a WithAttrResponse.

func (*WithAttrRequest) URLSuffix Uses

func (r *WithAttrRequest) URLSuffix() string

type WithAttrResponse Uses

type WithAttrResponse struct {
    WithAttr []*WithAttrItem `json:"withAttr"`
    Meta     MetaMap         `json:"meta"`

    Error     string `json:"error,omitempty"`
    ErrorType string `json:"errorType,omitempty"`
}

WithAttrResponse is the JSON response from $searchRoot/camli/search/permanodeattr.

func (*WithAttrResponse) Err Uses

func (r *WithAttrResponse) Err() error

Package search imports 30 packages (graph). Updated 2018-04-14. Refresh now. Tools for package owners.