MCPcopy Index your code
hub / github.com/perkeep/perkeep / Predicate

Method Predicate

pkg/search/predicate.go:371–400  ·  view source on GitHub ↗
(ctx context.Context, args []string)

Source from the content-addressed store, hash-verified

369}
370
371func (w with) Predicate(ctx context.Context, args []string) (*Constraint, error) {
372 // TODO(katepek): write a query optimizer or a separate matcher
373 c := &Constraint{
374 // TODO(katepek): Does this work with repeated values for "with"?
375 // Select all permanodes where attribute "with" points to permanodes with the foursquare person type
376 // and with first or last name partially matching the query string
377 Permanode: &PermanodeConstraint{
378 Attr: "with",
379 ValueInSet: andConst(
380 &Constraint{
381 Permanode: &PermanodeConstraint{
382 Attr: nodeattr.Type,
383 Value: "foursquare.com:person",
384 },
385 },
386 orConst(
387 permWithAttrSubstr(nodeattr.GivenName, &StringConstraint{
388 Contains: args[0],
389 CaseInsensitive: true,
390 }),
391 permWithAttrSubstr(nodeattr.FamilyName, &StringConstraint{
392 Contains: args[0],
393 CaseInsensitive: true,
394 }),
395 ),
396 ),
397 },
398 }
399 return c, nil
400}
401
402type title struct {
403 matchPrefix

Callers

nothing calls this directly

Calls 3

andConstFunction · 0.85
orConstFunction · 0.85
permWithAttrSubstrFunction · 0.85

Tested by

no test coverage detected