Find all contacts starting with @

Hi there,

Since I started with LogSeq I started tagging people with #@name. Did someone do the same? If I want to list all tags which are starting with @, how can this be done using a query?

Thanks for sharing :pray:

1 Like

Something like this:

#+BEGIN_QUERY
{
 :query [:find (pull ?page [* ])
 :where
   [?block :block/refs ?page]
   [?page :block/name ?name]
   [(clojure.string/starts-with? ?name "@")]
 ]
}
#+END_QUERY

Great, many thanks! This works fine for @Peter.

When it is a llittle more complex like friends/@Jan it does not list Jan. How can this query also list Jan?

friends/@Jan is not a good idea to begin with. But if this is not discussable, could replace starts-with? with includes? . For complexity beyond this point, regular expressions are needed.

@mentaloid, this is perfect. Many thanks.

Can you explain why you think friends/@Jan, family/@Bert or CompanyX/@Peter is not working for you?

  • Multiple reasons. For example, what happens when:
    • you make another friend named @Jan?
      • People have surnames for a reason.
        • Name/Surname is also a bad order.
    • @Peter changes company?
      • @Peter doesn’t belong to that (or any) company in any sense.
        • He is merely associated to that company for some time-period.
  • Check Namespaces make my life miserable. Are they worth it?