Questions tagged [elementquery]

The tag has no usage guidance.

6 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
165 views

Group by Date Field in Element API Query

I have a custom field called releaseDate in one of my entry types. I would like to use Element API to get all the distinct years assigned to those entries. I dump all the years for all entries just ...
1
vote
1answer
34 views

How do I flush the query cache?

How do I flush Craft's query cache so that I may query a relationship field again in the same web request with a new set of parameters? In this particular scenario, I need to handle it inside of a ...
1
vote
0answers
45 views

Advanced queries with assets and other custom fields

To optimize performance, I'm trying to create an advanced entry query that selects only specific variables. I can set up the query to grab the entry title, uri, and a custom variable I created ("email"...
1
vote
0answers
47 views

What's the most performant way to get reverse related entries within an Element Query?

What's the most performant way to get reverse related entries within an Element Query? Here's a contrived example of this. I have thousands of "book" entries and thousands of "collection" entries. I ...
1
vote
0answers
43 views

Order entries by a matrix field category

I have a lot of trouble in understanding the database/model structure and how to work with the query builder. I tried playing a bit with leftJoins but i cannot seem to make complex queries in craft 3. ...
0
votes
0answers
25 views

How to add an Element sortOption to sort by number?

I have an Element. It's a Structure, with one level (not sure if that is relevant). I'd like to add a Sort Option that allows a user to sort the Element Index page for this Element by a number. The ...