jeudi 27 août 2015

Canonical way to represent and query many to one relationships in Solr

I have PostgreSQL and Solr running in the backend, and am using EmberJS with ember-data on the frontend.

In PostgreSQL I have a many to one relation where one article can have many video links. Ember-data requires that this be returned in the format:

{
    articles: {
        //Some number of articles
    },
    videos: {
        //Videos that belong to those articles
    }
}

Now what I intend to do is import from the database into Solr to allow searching on the data. This is where I begin to be confused.

I decided that the best way to go about doing this would be to separately make a core for the videos and make a core for the articles, and then import into both cores separately as well. However, I'm new to Solr and am unsure if having multiple cores is the canonical way to handle a many to one relationship.

Moreover, as far as I know, you can't do a join on two cores when querying which means to construct the JSON that ember requires it'll take multiple queries, which seems wrong to me.

How can I properly represent a many to one relationship in Solr?




Aucun commentaire:

Enregistrer un commentaire