That's a perfectly reasonable request. But, WDF doesn't have such a feature.

Maybe what is needed is a distinct "ampersand filter" that runs before WDF and detects ampersands that are likely shorthands for "and" and expands them. It would also need to be able to detect "AT&T" (capital letter before the &) and not expand it (and you can set up a character type table for WDF that treats "&" as a letter. A single "&" could also be expanded to "and" - that could also be done with the synonym filter, but that would not help you with the embedded "&" of "Apples&Oranges".

Maybe a simple character filter that always expands "&" to " and " would be good enough for a lot of common cases, as a rough approximation.

Maybe solr.PatternReplaceCharFilterFactory could be used to accomplish that. Match "&" and replace with " and ".

-- Jack Krupansky

-----Original Message----- From: Stephen Lacy
Sent: Wednesday, July 04, 2012 8:16 AM
To: solr-user@lucene.apache.org
Subject: WordDelimiterFilter removes ampersands

If a user writes a query "Apples & Oranges" the word delimiter filter
factory will change this into "Apples Oranges"
Which isn't very useful for me as I'd prefer especially when the phrase is
wrapped in quotes that the original is preserved.
However I still want to be able to separate Apples&Oranges into Apples &
Oranges so preserveOriginal isn't really useful.
What I really would like to be able to do is tell WordDelimeterFilter to
treat it like it's neither alpha nor numeric, however
that doesn't mean that you remove it completely.

Thanks for your help
Stephen

Reply via email to