Filter pages by tag and then search for text within them?

Hello!

I am using the built-in query generator and I have managed to return all the pages with a certain tag using
{{query (property :tags “grossed”)}}

I would now like to limit the pages again by searching all the pages for certain text like “adenocarcinoma”. When I try {{query (and (property :tags “grossed”) “adenocarcinoma”)}}
I don’t get any results back.

Thank you!

It works ok to me. Could you share some example blocks?

If I create a page structured as such:
tags::spcase
ovaries

the search {{query (and (property :tags “spcase”) “ovaries”)}} returns nothing
but {{query (property :tags “spcase”)}} will return the page

This is what I get:

  • Double-check the syntax:
    • the block needs a space in between tags:: and spcase
    • if the double quotes are pasted, explicitly retype them
  • Try in a new empty graph, preferably without plugins or other customizations.
  • Check if your Logseq installation is up-to-date.
  • If you provide an actual screenshot like the above, we may notice something suspicious.

Here are some screenshots!
If I do the spcase query I get

But if I search the page for text I know is in one of the blocks of the returned pages like Endometriotic cysts I get nothing back as shown below:

Try this:

#+BEGIN_QUERY
{
 :query [:find (pull ?b [*])
 :where
   [?tag :block/name "spcase"]
   [?p :block/tags ?tag]
   [?b :block/page ?p]
   [?b :block/content ?content]
   [(clojure.string/includes? ?content "Endometriotic cysts")]
 ]
}
#+END_QUERY
1 Like

Thank you, that works perfectly! I would not have been able to figure it out on my own.