Valid query returns nothing when used in :default-queries

Continuing the discussion from List of recently created/modified pages (timestamp issues):

I have a valid query (i.e. i works when I put it into a block on a page). I want to use it in :default-queries in config.edn, but it just does not return anything.

Queries from my config.edn:

 :default-queries
 {:journals
  [{:title "🔨 DOING"
    :query [:find (pull ?h [*])
            ;;:in $ ?start ?today
            :where
            [?h :block/marker ?marker]
            [(contains? #{"NOW" "DOING"} ?marker)] 
            [?h :block/page ?p]]
            ;;[?p :block/journal? true]
            ;;[?p :block/journal-day ?d]
            ;;[(>= ?d ?start)]
            ;;[(<= ?d ?today)]]
    ;;:inputs [:14d :today]
    :breadcrumb-show? false
    :result-transform (fn [result]
                        (sort-by (fn [h]
                                   (get h :block/priority "Z")) result))
    :collapsed? false}
   {:title "đź“… NEXT"
    :query [:find (pull ?h [*])
            :in $ ?start ?next
            :where
            [?h :block/marker ?marker]
            [(contains? #{"NOW" "LATER" "TODO"} ?marker)]
            [?h :block/ref-pages ?p]
            [?p :block/journal? true]
            [?p :block/journal-day ?d]
            [(> ?d ?start)]
            [(< ?d ?next)]]
    :inputs [:today :7d-after]
    :collapsed? false}
	{:title [:h2 "My 24h changes"] ;; <<<<<<<<<<<<<<<<<<< THIS ONE
	:query [:find (pull ?b [* {:block/_parent ...}])
			:in $ ?end
			:where
			[?b :block/updated-at ?v]
			[(- ?end 86400000 ) ?period]
			[(>= ?v ?period)]
			[(< ?v ?end)]
			]
	:inputs [:end-of-today-ms]
	:collapsed? false
	}
   ]}

It is about the last one, “My 24h changes”.

Query results when used in a normal block:
grafik

Query results on journal page:
grafik

So yeah, 3 results. But where is the output?

1 Like

@Ramses, you moved this question to “look what i built”. I think that is not in the spirit of that category (unless you want to showcase broken queries).

More on-topic: The query still does not work (logseq 0.7.1) and I am still interested in insights of what might be wrong with it and why it does show nothing on the journal page.

My bad! Was the title different before?

Where did you have this post filed under before? I’ll move it back. Again, sorry.

Don’t worry too much about this stale post, seems nobody could help me here anyway :wink:
I think I had it in a “Queries” category, but I no longer find that. Maybe that’s why you moved it? Anyway, “Questions & Help” appears suitable for this post. The title is unchanged.

You’re right, I’ve consolidated some categories and got rid of the “Queries” one. Sorry again. I’ve moved it to Questions & Help.

1 Like

Having the exact issue. @Ramses any updates/suggestions on this?

Is there a possibility that you edited the wrong config? Each graph has its own config, look for the config file under the logseq folder of your current graph. I wasted many hours editing the ~/.logseq/config.edn, and questioned the same, what the hell, why the default queries don’t work?

Reindex+restart fixed it actually, odd

1 Like