Thanks Jan, for the links and quick explanation.

In our case Solr is integrated into the CMS we use, so I Think upgrading to a 
4.4+ version (that supports write calls to the Schema API) is not an option at 
the moment.

The field alias function for the result set sounds simple enough, as long as we 
will be able to modify the search request in all places that we need to perform 
a search with such fields (there might be cases where the CMS would be in the 
way).

The field alias function for queries sounds a bit more complex. But if I 
understood things correctly, this can also be configured by simple addition of 
URL parameters for the search request, right?

Regards
/Jimi

________________________________________
From: Jan Høydahl [jan....@cominvent.com]
Sent: Tuesday, October 22, 2013 1:43 PM
To: solr-user@lucene.apache.org
Subject: Re: Any way to dynamically rename fields in the schema?

Hi,

In general, if you use dynamic fields you will have to live with some 
predictable naming pattern.
If you want to stick with dynamic fields, but use clean names, there are a few 
features worth looking at;

Field name aliases:
https://cwiki.apache.org/confluence/display/solr/Common+Query+Parameters#CommonQueryParameters-FieldNameAliases
This renames fields in the result set

Aliases in edismax
http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2F_renaming
Lets your users query pretty field names instead of the dynamic ones


If this is not for you, please consider the new Schema API, in which you can 
programmatically add fields to the schema right before you need them:
https://cwiki.apache.org/confluence/display/solr/Schema+API

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

22. okt. 2013 kl. 12:53 skrev jimi.hulleg...@svensktnaringsliv.se:

> Hi,
>
> Is there a way to dynamically change a field name using some magic regex or 
> similar in the schema file?
> For example, if we have a field named "subtitle_string_indexed_stored", then 
> we could have a dynamic field that matches "*_string_indexed_stored" and then 
> renames it to simply "subtitle" (ie simply removes the 
> "_string_indexed_stored" part).
>
> The reasons we want this are:
>
> 1. We don't want to have to update the schema every time we need to 
> index/store a new field.
>
> 2. We want to be able to specify how each field should be indexed/stored.
>
> 3. We want to be able to use simple and clean field names when searching and 
> fetching stored fields. Like "subtitle".
>
>
> Number one above means that we must use dynamic fields of some type (right?). 
> And number two means that we must have a separate dynamic field for each 
> configuration combination, and the only way to controll that is by some 
> naming standard in the field names.
>
> So these two combined means that we will end up with fields with ugly 
> prefixes that controlls the internal behaivor of solr. Ie it doesn't go well 
> combined with the third number in the list above.
>
> Is there a way to solve this?
>
>
> Regards
> /Jimi

Reply via email to