Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying for related entries by their contentType #223

Open
0xStarcat opened this issue May 7, 2020 · 1 comment
Open

Querying for related entries by their contentType #223

0xStarcat opened this issue May 7, 2020 · 1 comment

Comments

@0xStarcat
Copy link

0xStarcat commented May 7, 2020

Hello! I'm having an issue trying to query for entries by a related entry's contentType.

I have 3 models - Resource, BlogPost and Video

I'm trying to query this model:

Resource

which has the single-reference field:

RESOURCE:

  • entry => BlogPost or Video

My query using the gem looks like this:

Content::Resource.all('fields.entry.sys.contentType.sys.id': 'blogPost', include: 4)

(the internal implementation of this should be fine, as include: 4 is passed correctly as an option along with the field query in the logs)

I get no errors.

What I get back is:

100 Resource entries, containing a mix of BlogPost and Video entries linked to the entry field

What i want is:

Only Resource entries with BlogPosts linked to the entry field

Any clue where the issue is? Thank you!

@rubydog
Copy link
Collaborator

rubydog commented Sep 18, 2020

Hi @0xStarcat!

Currently this is not possible with our Search API, you will have to filter manually by type, as our Search API only allows to use the relationship queries to filter by a value on the relationship and not by the relationship type itself.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants