lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <jimi.hulleg...@svensktnaringsliv.se>
Subject RE: Default value from another field?
Date Tue, 03 Oct 2017 16:14:20 GMT
Hi Emir,

Thanks for the tip about DefaultValueUpdateProcessorFactory. But even though I agree that
it most likely isn't too hard to write custom code that does this, the overhead is a bit too
much I think considering we now use a vanilla Solr with no custom code deployed. So we would
need to setup a new project, and a new deployment procedure, and that is a bit overkill considering
that this is a feature that would help me as a developer and administrator only a little bit
(ie nice-to-have), and at the same time would not have any impact for any end user (except,
possibly negative side effects because of bugs etc).

Regards
/Jimi


-----Original Message-----
From: Emir Arnautović [mailto:emir.arnautovic@sematext.com] 
Sent: Tuesday, October 3, 2017 3:28 PM
To: solr-user@lucene.apache.org
Subject: Re: Default value from another field?

Hi Jimi,
I don’t think that you can do it using schema, but you could do it using custom update request
processor chain. I quickly scanned to see if there is such processor and could not find one.
The closest one is https://lucene.apache.org/solr/6_6_0//solr-core/org/apache/solr/update/processor/DefaultValueUpdateProcessorFactory.html
<https://lucene.apache.org/solr/6_6_0//solr-core/org/apache/solr/update/processor/DefaultValueUpdateProcessorFactory.html>
It should not be too hard to adjust it to do what you need.

HTH,
Emir

--
Monitoring - Log Management - Alerting - Anomaly Detection Solr & Elasticsearch Consulting
Support Training - http://sematext.com/



> On 3 Oct 2017, at 14:10, jimi.hullegard@svensktnaringsliv.se wrote:
> 
> Hi,
> 
> Is it possible using some Solr schema magic to make solr get the default value for a
field from another field? Ie, if the value is specified in the document to be indexed, then
that value is used. Otherwise it uses the value of another field. As far as I understand it,
the field property "default" only takes a static value, not a reference to another field.
And the copyField element doesn't solve this problem either, since it will result in two values
if the field was specified in the document, and I only want a single value.
> 
> /Jimi

Mime
View raw message