0

I am developing an app, where I retrieve data from a firebase realtime database. One the one hand, I got my objects. There will be around 10000 entries when it is finished. A user can select for each property like "Blütenfarbe" (flower color) 1 (or more) characteristics, where he will then get the result plants, on which these constraints are true. Each property has 2-10 characteristics.

Is querying here powerful enough, to get fast results ? If not, my thought would be to also setup container for each characteristic and put every ID in that, when it is a characteristic of that plant. This is my first project, so any tip for better structure is welcome. I don't want to create this database and realize afterwards, that it is not well enough structured.

Thanks for your help :)

 {
  "Pflanzen" : {

    "Objekt" : {
      "00001" : {
        "Belaubung" : "Sommergrün",
        "Blütenfarbe" : "Gelb",
        "Blütezeit" : "Februar",
        "Breite" : 20,
        "Duftend" : "Ja",
        "Frosthärte" : "Ja",
        "Fruchtschmuck" : "Nein",
        "Herbstfärbung" : "Gelb",
        "Höhe" : 20,
        "Pflanzengruppe" : "Laubgehölze",
        "Standort" : "Sonnig",
        "Umfang" : 10
      },
      "00002" : {
        "Belaubung" : "Sommergrün",
        "Blütenfarbe" : "Gelb",
        "Blütezeit" : "März",
        "Breite" : 25,
        "Duftend" : "Nein",
        "Frosthärte" : "Ja",
        "Fruchtschmuck" : "Nein",
        "Herbstfärbung" : "Ja",
        "Höhe" : 10,
        "Pflanzengruppe" : "Nadelgehölze",
        "Standort" : "Schatten",
        "Umfang" : 10
      },
      "Eigenschaften" : {
        "Belaubung" : {
          "Sommergrün" : [  "00001", "00002" ],
          "Wintergrün" : ["..."]
      },
        "Blütenfarbe" : {
          "Braun": ["00002"],
          "Blau" : [ "00001" ]
      },
      }
    }
  }
}
KENdi
  • 7,576
  • 2
  • 16
  • 31
Tjard L
  • 13
  • 3
  • Firebase Database queries can only order/filter on a single property. In many cases it is possible to combine the values you want to filter on into a single (synthetic) property. So in your case you could add: `"Blütenfarbe_Blütezeit": "Gelb_Februar"` and filter on that. For another example of this and other approaches, see my answer here: http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase – Frank van Puffelen Mar 06 '19 at 14:46
  • But even with such an approach there's a limit to the querying capabilities of Firebase, as it only has the querying capabilities that it can maintain under its main focus: scalable realtime data synchronization. If you need broader querying consider another/additional solution, such as Elasticsearch or Algolia. See https://stackoverflow.com/a/10559689/209103 – Frank van Puffelen Mar 06 '19 at 14:48

0 Answers0