I've implemented a JavaScript script for the StatelessScriptUpdate processor that does country code to continent code mapping. It will appear in the next early access of my "Solr 4.x Deep Dive" book (on 8/16.)

One interesting issue: These countries that span continents - Turkey and Russia and some of the former USSR Republics.

I arbitrarily assigned them a single continent:

// Note: Turkey is mapped to Asia, and Russia to Europe,
//       Azerbaijan to Asia, Armenia to Asia, Cyprus to Asia,
//       Georgia to Asia, Kazakhstan to Asia,

(I hope I don't get too much hate mail from the Greeks for considering Cyprus to be part of Asia, but it is closer.)

I suppose continent could be multivalued or maybe a composite string ("eu/as" or "eu+as"), but that has an impact on queries.

But, the scripts also handles multivalued fields (one value at a time), and nested multivalued fields is not supported.

Thoughts?

-- Jack Krupansky

-----Original Message----- From: Christian Köhler - ZFMK
Sent: Tuesday, August 06, 2013 5:18 AM
To: solr-user@lucene.apache.org
Subject: Re: Transform data at index time: country -> continent

Am 05.08.2013 15:52, schrieb Jack Krupansky:
You can write a brute force JavaScript script using the StatelessScript
update processor that hard-codes the mapping.

I'll probably do something like this. Unfortunately I have no influence
on the original db itself, so I have fix this in solr.

Cheers
Chris


--
Zoologisches Forschungsmuseum Alexander Koenig
- Leibniz-Institut für Biodiversität der Tiere -
Adenauerallee 160, 53113 Bonn, Germany
www.zfmk.de

Stiftung des öffentlichen Rechts; Direktor: Prof. J. Wolfgang Wägele
Sitz: Bonn

Reply via email to