Answers.Body: <p>The answer is still “no”.</p>
  <p>I don’t think the desire to add the feature has died out, even if the GitHub <a href="https://github.com/craftcms/cms/discussions/8128" rel="nofollow noreferrer">discussion</a> feels somewhat stale. It was on the <a href="https://craftcms.com/roadmap" rel="nofollow noreferrer">roadmap</a> not too long ago but I no longer see it there. Why don’t you revive the discussion? It still seems like a much (and long) requested feature that would be very handy to have.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-01T21:54:53.863Z
Answers.LastActivityDate: 2024-04-01T21:54:53.863Z
Answers.UserDisplayName: Ben Croker
Answers.Body: <p>I haven't tried this myself, but a potential workaround would be to execute the separate queries (unpaginated), merge them all and then sort by score, and then do pagination afterwards using the <code>create</code> function like this: <a href="https://gist.github.com/juban/a55781d49f2f68ec3ca47979bcaaa49a" rel="nofollow noreferrer">https://gist.github.com/juban/a55781d49f2f68ec3ca47979bcaaa49a</a></p>
  <p><a href="https://craftcms.com/docs/4.x/dev/functions.html#create" rel="nofollow noreferrer">https://craftcms.com/docs/4.x/dev/functions.html#create</a></p>
  <p>(When encountering this problem myself in the past, so far I've always managed to get away with a (very large) non-paginated result set, grouped by types (&quot;types&quot; might be category groups, entry sections, product groups, or assets etc). Typically I arrange those types visually into tabs - this makes it more obvious that each tab is effectively a new 'relevance context'.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-02T08:22:58.133Z
Answers.LastActivityDate: 2024-04-02T08:30:39.367Z
Answers.LastEditDate: 2024-04-02T08:30:39.367Z
Answers.UserDisplayName: James Smith
Body: <p>Yup, this is a repeat of a question from <a href="https://craftcms.stackexchange.com/questions/20829/how-do-i-query-multiple-element-types-in-one-query">7 years ago</a>. The <a href="https://github.com/craftcms/cms/discussions/8128" rel="nofollow noreferrer">github discussion</a> seems to have died out 2 years ago.</p>
  <p>I can't do weird array merging due to <a href="https://craftcms.com/docs/4.x/element-queries.html#pagination" rel="nofollow noreferrer">pagination</a> which <code>accepts an element query</code>. So it needs to be a single query.</p>
  <p>I want a site search that will return entries and <a href="https://plugins.craftcms.com/shopify" rel="nofollow noreferrer">Shopify products</a>. I can't be the first person to try doing this.</p>
  
Tags: <search><craft4>
Title: Can I search multiple element types in one query?
ThreadText: # Can I search multiple element types in one query?
  
  (Asked by: username_0 on 2024-04-01)
  
  Yup, this is a repeat of a question from [7 years ago](https://craftcms.stackexchange.com/questions/20829/how-do-i-query-multiple-element-types-in-one-query). The [github discussion](https://github.com/craftcms/cms/discussions/8128) seems to have died out 2 years ago.
  
  I can't do weird array merging due to [pagination](https://craftcms.com/docs/4.x/element-queries.html#pagination) which `accepts an element query`. So it needs to be a single query.
  
  I want a site search that will return entries and [Shopify products](https://plugins.craftcms.com/shopify). I can't be the first person to try doing this.
  
  **Tags:** search, craft4
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2024-04-01. Score: 2 | Accepted answer
  
  The answer is still “no”.
  
  I don’t think the desire to add the feature has died out, even if the GitHub [discussion](https://github.com/craftcms/cms/discussions/8128) feels somewhat stale. It was on the [roadmap](https://craftcms.com/roadmap) not too long ago but I no longer see it there. Why don’t you revive the discussion? It still seems like a much (and long) requested feature that would be very handy to have.
  
  
  ---
  
  ### Answer by username_2 on 2024-04-02. Score: 1
  
  I haven't tried this myself, but a potential workaround would be to execute the separate queries (unpaginated), merge them all and then sort by score, and then do pagination afterwards using the `create` function like this: <https://gist.github.com/juban/a55781d49f2f68ec3ca47979bcaaa49a>
  
  <https://craftcms.com/docs/4.x/dev/functions.html#create>
  
  (When encountering this problem myself in the past, so far I've always managed to get away with a (very large) non-paginated result set, grouped by types ("types" might be category groups, entry sections, product groups, or assets etc). Typically I arrange those types visually into tabs - this makes it more obvious that each tab is effectively a new 'relevance context'.
  
  
  ---
  
  