> I'm using Solr 4 RC, and my documents look like this:
> 
> <doc>
>   <id>123</id>
>   <name>Folder name</name>
> </doc>
> <doc>
>   <id>abc</id>
>   <name>Document 1</name>
>   <parentid>123</parentid>
> </doc>
> <doc>
>   <id>def</id>
>   <name>Document 2</name>
>   <parentid>123</parentid>
> </doc>
> 
> Meaning there are two documents which are in the same folder in this
> example. When querying documents I need the name of the folder the
> documents are in, so when "Document 2" above is part of the result set from
> Solr, I need the name of the parent folder, which is "Folder name" in this
> case.

I am not sure if Solr is built for join-operations on documents. I think 
storing the same information is the normal case for NoSQL databases. But I am 
not sure if Solr is a real NoSQL database neither.

> 3. Denormalize the data, and store the folder for each document. The
> drawback with this though is that all documents in a folder must be
> changed/reindexed when the folder name changes.

If the folder names change often, you could use solr.ExternalFileField to avoid 
re-indexing the documents on every folder name changes:
http://lucidworks.lucidimagination.com/display/solr/Solr+Field+Types#SolrFieldTypes-WorkingwithExternalFiles

Reply via email to