Solr : how do i index and search several fields?

Posted by sbrattla on Stack Overflow See other posts from Stack Overflow or by sbrattla
Published on 2010-06-02T06:47:41Z Indexed on 2010/06/02 6:53 UTC
Read the original article Hit count: 238

Filed under:

Hi,

I've set up my first 'installation' of Solr, where each index (document) represents a musical work (with properties like number (int), title (string), version (string), composers (string) and keywords (string)). I've set the field 'title' as the default search field.

However, what do I do when I would like to do a query on all fields? I'd like to give users the opportunity to search in all fields, and as far as I've understood there is at least two options for this:

(1) Specify which fields the query should be made against.

(2) Set up the Solr configuration with copyfields, so that values added to each of the fields will be copied to a 'catch-all'-like field which can be used for searching. However, in this case, i am uncertain how things would turn out when i take into consideration that the data types are not all the same for the various fields (the various fields will to a lesser og greater degree go through filters, but as copyfield values are taken from their original fields before the values have been run through their original fields' filters, i would have to apply one single filter to all values on the copyfield. This, again, would result in integers being 'filtered' just as strings would).

Is this a case where i should use copyfields? At first glance, it seems a bit more 'flexible' to rather just search on all fields. However, maybe there's a cost?

All feedback appreciated! Thanks!

© Stack Overflow or respective owner

Related posts about solr