(I think you're better off with an update processor script, but...)

The synonym filter supports 2.5 modes:

1. Replace mode

country => continent

2. Expand mode

country, continent

- results in both terms if either is used

2.5) The expand="false" attribute that means treat expand mode as replace with the first term as the replacement.

continent, country

- would be treated as:

country, continent => continent

The expand="true" attribute is simply the normal expand mode.

Expand mode is really just replacement mode with the terms auto-copied to the right side of the "=>", so:

country, continent

is equivalent to:

country, continent => country, continent

-- Jack Krupansky

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

Hi,

I have thought about synonyms as well. But wouldn't leave me this with a
field that contains both the original expression and additionally the
continent? e.g. "germany, continent-europe". I am not sure if this might
get in the way at some point.

On the other hand this would enable my to have a single search field,
where the user could search by country or continent. Interesting - I'll
give it a thought.

Thanx
Chris


Am 07.08.2013 17:56, schrieb Walter Underwood:
Good point. Copying to a separate field that applied synonyms could help.

Filtering out the original countries could be tricky. The Javadoc mentiones a keepOrig flag, but the Solr docs do not. If you could set keepOrig=false, that would do the trick.

wunder

On Aug 7, 2013, at 5:13 AM, Erick Erickson wrote:

Walter:

Oooh, nice! One could even use a copyField if one wanted to
keep them separate...

Erick


On Tue, Aug 6, 2013 at 12:38 PM, Walter Underwood <wun...@wunderwood.org>wrote:

Would synonyms help? If you generate the query terms for the continents,
you could do something like this:

usa => continent-na
canada => continent-na
germany => continent-europe

und so weiter.

wunder

On Aug 6, 2013, at 2:18 AM, Christian Köhler - ZFMK wrote:

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







--
Walter Underwood
wun...@wunderwood.org






--
Christian Köhler
Tel.: 0228 9122-433

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
--
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