(ctx context.Context, s *search, br blob.Ref, bm camtypes.BlobMeta)
| 1677 | } |
| 1678 | |
| 1679 | func (c *PermanodeConstraint) blobMatches(ctx context.Context, s *search, br blob.Ref, bm camtypes.BlobMeta) (ok bool, err error) { |
| 1680 | if bm.CamliType != schema.TypePermanode { |
| 1681 | return false, nil |
| 1682 | } |
| 1683 | corpus := s.h.corpus |
| 1684 | |
| 1685 | var dp *DescribedPermanode |
| 1686 | if corpus == nil { |
| 1687 | dr, err := s.h.DescribeLocked(ctx, &DescribeRequest{BlobRef: br}) |
| 1688 | if err != nil { |
| 1689 | return false, err |
| 1690 | } |
| 1691 | db := dr.Meta[br.String()] |
| 1692 | if db == nil || db.Permanode == nil { |
| 1693 | return false, nil |
| 1694 | } |
| 1695 | dp = db.Permanode |
| 1696 | } |
| 1697 | |
| 1698 | if c.Attr != "" { |
| 1699 | if !c.At.IsZero() && corpus == nil { |
| 1700 | panic("PermanodeConstraint.At not supported without an in-memory corpus") |
| 1701 | } |
| 1702 | var vals []string |
| 1703 | if corpus == nil { |
| 1704 | vals = dp.Attr[c.Attr] |
| 1705 | } else { |
| 1706 | s.ss = corpus.AppendPermanodeAttrValues( |
| 1707 | s.ss[:0], br, c.Attr, c.At, s.h.owner.KeyID()) |
| 1708 | vals = s.ss |
| 1709 | } |
| 1710 | ok, err := c.permanodeMatchesAttrVals(ctx, s, vals) |
| 1711 | if !ok || err != nil { |
| 1712 | return false, err |
| 1713 | } |
| 1714 | } |
| 1715 | |
| 1716 | if c.SkipHidden && corpus != nil { |
| 1717 | defVis := corpus.PermanodeAttrValue(br, "camliDefVis", c.At, s.h.owner.KeyID()) |
| 1718 | if defVis == "hide" { |
| 1719 | return false, nil |
| 1720 | } |
| 1721 | nodeType := corpus.PermanodeAttrValue(br, "camliNodeType", c.At, s.h.owner.KeyID()) |
| 1722 | if nodeType == "foursquare.com:venue" { |
| 1723 | // TODO: temporary. remove this, or change |
| 1724 | // when/where (time) we show these. But these |
| 1725 | // are flooding my results and I'm about to |
| 1726 | // demo this. |
| 1727 | return false, nil |
| 1728 | } |
| 1729 | } |
| 1730 | |
| 1731 | if c.ModTime != nil { |
| 1732 | if corpus != nil { |
| 1733 | mt, ok := corpus.PermanodeModtime(br) |
| 1734 | if !ok || !c.ModTime.timeMatches(mt) { |
| 1735 | return false, nil |
| 1736 | } |
nothing calls this directly
no test coverage detected