Git Product home page Git Product logo

Comments (4)

tkrugg avatar tkrugg commented on July 17, 2024

Hi sant527, I think in your case it'd make sense to use model inheritance.
You'd create a BabyThing

class BabyThing(model.Model):
    name = ... 
    description = ...

class BabyDoctor(BabyThing):
    .... other fields not common

class BabyStore(BabyThing):
    .... other fields not common

class BabySitter(BabyThing):
    .... other fields not common

Then just setup indexing for BabyThing model.

from algoliasearch-django.

sant527 avatar sant527 commented on July 17, 2024

How to create facets in this case

from algoliasearch-django.

tkrugg avatar tkrugg commented on July 17, 2024

Hey @sant527 sorry for the late reply. I've ready your other issue #321

I want to put several modes in singel index. Then only i can make use of facets
like i have models for store, item etc
I want a single index for searching anything store or item.
So i want to add some category and put thesemodels in same index.
How can i do this

I'm not entirely sure what would prevent you from creating facets in this case. Once you data is indexed, you should be able to create a facet.
If you BabyThing parent models has a category field, it should be indexable and configurable as a facet.

class BabyThing(model.Model):
    name = ... 
    description = ...
    category = models.CharField(max_length=30)

Then you'll be able to create:

  • BabySitter(name="Suzy", description="...", category="3-5yo")
  • BabyStore(name="The awesome store", description="...", category="3-5yo")

Can you elaborate on the problem you're facing with this appoarch ?
BTW, I'll close #321 to continue the discussion here.

from algoliasearch-django.

tkrugg avatar tkrugg commented on July 17, 2024

I'll close this issue. Happy to investigate this again after you elaborate on the problem you're facing with my approach. Feel free to reopen then.

from algoliasearch-django.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.