mirror of https://github.com/perkeep/perkeep.git
search: add is:post and is:checkin
Change-Id: I0d7c5f969de5a5c6bbf6dfd7acfb4774f0a00d4a
This commit is contained in:
parent
509b484ae0
commit
a57da00936
|
@ -117,6 +117,10 @@ func init() {
|
|||
registerKeyword(newIsPortait())
|
||||
registerKeyword(newWidth())
|
||||
|
||||
// Custom predicates
|
||||
registerKeyword(newIsPost())
|
||||
registerKeyword(newIsCheckin())
|
||||
|
||||
// Location predicates
|
||||
registerKeyword(newHasLocation())
|
||||
registerKeyword(newLocation())
|
||||
|
@ -628,3 +632,47 @@ func mimeFromFormat(v string) (string, error) {
|
|||
}
|
||||
return "", fmt.Errorf("Unknown format: %s", v)
|
||||
}
|
||||
|
||||
// Custom predicates
|
||||
|
||||
type isPost struct {
|
||||
matchEqual
|
||||
}
|
||||
|
||||
func newIsPost() keyword {
|
||||
return isPost{"is:post"}
|
||||
}
|
||||
|
||||
func (k isPost) Description() string {
|
||||
return "matches tweets, status updates, blog posts, etc"
|
||||
}
|
||||
|
||||
func (k isPost) Predicate(ctx *context.Context, args []string) (*Constraint, error) {
|
||||
return &Constraint{
|
||||
Permanode: &PermanodeConstraint{
|
||||
Attr: "camliNodeType",
|
||||
Value: "twitter.com:tweet",
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
type isCheckin struct {
|
||||
matchEqual
|
||||
}
|
||||
|
||||
func newIsCheckin() keyword {
|
||||
return isCheckin{"is:checkin"}
|
||||
}
|
||||
|
||||
func (k isCheckin) Description() string {
|
||||
return "matches location check-ins (foursquare, etc)"
|
||||
}
|
||||
|
||||
func (k isCheckin) Predicate(ctx *context.Context, args []string) (*Constraint, error) {
|
||||
return &Constraint{
|
||||
Permanode: &PermanodeConstraint{
|
||||
Attr: "camliNodeType",
|
||||
Value: "foursquare.com:checkin",
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue