You can have two parallel multi-value fields and as long as you don't introduce null/empty values, they will kept together. However, for recent Solr (4.7? certainly 4.8), you may want to look at parent/child entries and join/parent/child queries.
Regards, Alex. Personal website: http://www.outerthoughts.com/ Current project: http://www.solr-start.com/ - Accelerating your Solr proficiency On Tue, May 6, 2014 at 7:20 AM, Steve Edwards <killsho...@gmail.com> wrote: > I'm using Sorl to create an image search functionality that allows users to > search for an existing image in the site to add to new content. A given > piece of content has a field that can store multiple images, so I will need > to use a multi-value Solr field to store image data. Currently, I'm storing > the path and file name in a tom_* field, since I want to be able to search on > file name. However, another piece of data that I need to store and retrieve > is the file id used to identify the file in the database (in the same table > as the image path). What is the best way to store this data so that the file > id and path values are properly synced, since there can be multiple images > for each piece of content? I could just store the file path/name (I need > that data to be searchable, so it has to be stored in Solr), and then query > the db for the fid once I get the results back, but I'd rather not do that if > I don't have to. > > Searching around, it doesn't appear that I can store multiple pieces of data > in one field without doing some sort of concatenation and then splitting at > query time. If I just use two separate fields in each document, is it safe > to assume that the values will be synchronized in the search results? In > other words, if I put two values each into tom_image_path and > im_image_file_id, when I query and the document is returned, can I assume the > values in the two fields are synchronized? > > Or, is there a way to store multiple pieces of data in one field so that they > can be indexed together and then retrived together? > > Thanks. > > Steve