Multi-word synonyms are tricky.
You probably want to make sure this synonym is only expanded at index
time, and not at search time. See some background in the
SynonymFilterFactory section of
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
I think the synonym approach is a fine way to search for greek letters
by name; it's possible some of the new Unicode stuff in Solr 3.1 might
expand greek letters too, but I think actually probably not (because you
don't neccesarily want that in the general case), I think synonyms is
probably your best bet. (Same for things like expanding the musical
sharp or flat glyph to "sharp" or "flat", which I've considered).
On 5/27/2011 7:43 AM, Thomas Dowling wrote:
Greetings--
I'm trying to flesh out my synonyms.txt file for a couple of Solr indexes,
and I stumbled across something weird. I added these lines to synonyms.txt:
co2, carbon dioxide
ch4, methane
The second line worked as expected: I restarted Solr, reindexed, and could
search ch4 and methane as synonyms of each other.
The first line did something weird. Before the change, I can get results
for both CO2 and for "CARBON DIOXIDE" (just different results). After the
change, searching CO2 got zero results, as did "CARBON DIOXIDE". So at
least they're acting like synonyms, right? But why in the world do they
both stop finding hits?
Pre-change:
CO2 225 hits
"CARBON DIOXIDE" 130 hits
CARBON DIOXIDE 1030 hits
Post-change:
CO2 0 hits
"CARBON DIOXIDE" 0 hits
CARBON DIOXIDE 1030 hits
Also, if I want to be able to search for Greek letters by name (alpha,
beta, etc.), is there a better way than to use synonmyms.txt?
Δ,δ,delta
TIA