-
Notifications
You must be signed in to change notification settings - Fork 69
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
Handle foreign key automatically #13
Comments
Yep. The problem is to detect that it is a foreign key. I'm still investigating the Django's core to find a way to do it. |
Is it a request from a customer? |
yep |
Starting in Django 1.8 you have the Meta API. My understanding is you could use In previous Django versions you have to use the old api but the documentation explains it better than I would. |
Yes, I recommend using the Meta API for Django 1.8, |
I think this is the same as this issue and #2--I'm not even able to get through the installation instructions in the README because the first time I run
The If I could declare attributes in the |
Hey @jdotjdot, There is a lot of bugs fix and new features in the |
Just wanted to say I was able to get this working thanks to @dethi's comment ^^ but I'll also throw my hat in the ring that it was frustrating when I was setting this up and thinking I'd get up and running quickly and having a roadblock pretty much immediately in the form of an ambiguous exception I then had to Google. :) Thanks for making a great product overall though! EDIT: to clarify, I was able to get it working by specifying model fields manually, and specifically excluding ForeignKey fields. E.g., I had to do:
instead of:
where user is a ForeignKey. |
Is there a workaround to include fields from the ForeignKey model within the index? For example, using @thetylerhayes model:
|
Hi @calitidexvii |
Thanks @dethi
Where fk_fields would perform the DB lookup and append to the object? |
For anyone else needing a workaround, I was able to use callables within the model for the index.
Then the index:
This isn't perfect and may not work in all situations, but it seems to be sufficient when you need to manage user access with secured API keys. |
Would love to hear if there is any news as to when this might be available -- or how best to help make this a reality. This is an increasingly important use case for us. One example: Indexing User profile data, where some information may be in the User table and other information is in a UserProfile table. |
@abendig Due to the issue @dethi mentioned, I don't think there are any plans to extend the integration to handle relations. Do you have a working solution? If not, you could try my workaround above - using callables to get the necessary data. Due to increasingly complex relations, I ultimately ended up dumping the Django integration and writing custom methods using only the Python integration. If you need some direction, let me know. If you need/want the management functions of the Django integration, it may be worth forking and extending AlgoliaIndex to make the database calls for relations (caveat emptor). |
@abendig I just noticed, this was added to the 2.0.0 milestone in June 2016, but I don't see a timeline for it. |
Hi, |
Thanks a lot for the update. I do need to make this functionality work one way or another in the next couple weeks. How far along is this particular feature? Is it possible/useful to get involved in some way to drive the development of this forward? |
I would appreciate if you could provide me a django app that fakes your use case. |
Closed as stale without an answer from OP. |
For future readers, the readme now contains a section on indexing relations. |
Might be the same as #2
The text was updated successfully, but these errors were encountered: