(ctx context.Context, args []string)
| 369 | } |
| 370 | |
| 371 | func (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 | |
| 402 | type title struct { |
| 403 | matchPrefix |
nothing calls this directly
no test coverage detected