> > In the database this is modeled a a 1-N where category table has the > mapping of feed to category > I need to be able to query , give me all the feeds in any given category. > How can I best model this in solr? > Seems like multiValued field might help, but how would I populate it, and > would the query above work?. > Yes you are right. A multivalued field for "categories" is the answer.
For populating in the index - 1. If you use DIH to populate your indexes and your datasource is a database then you can use DIH's RegexTransformer on an aggregated list of categories. e.g. if your database query retruns "a,b,c,d" in a column called "db_categories", this is how you would put it in DIH's data-config file - <field column="db_categories" name="categories" splityBy="," />. 2. If you "add" documents to Solr yourself multiple values for the field can be specified as an array or list of values in the SolrInputDocument. A multivalued field provides the same faceting and searching capabilites like regular fields. There is no special syntax. Cheers Avlesh On Fri, Oct 30, 2009 at 4:55 AM, Joel Nylund <jnyl...@yahoo.com> wrote: > Hi, > > I have one index so far which contains feeds. I have been able to > de-normalize several tables and map this data onto the feed entity. There is > one tricky problem that I need help on. > > Feeds have 1 - many categories. > > So Lets say we have Category1, Category2 and Category3 > > Feed 1 - is in Category 1 > Feed 2 is in category2 and category3 > Feed 3 is in category2 > Feed 4 has no category > > In the database this is modeled a a 1-N where category table has the > mapping of feed to category > > I need to be able to query , give me all the feeds in any given category. > > How can I best model this in solr? > > Seems like multiValued field might help, but how would I populate it, and > would the query above work?. > > thanks > Joel > >