Not that I know of, synonyms are an all-or-nothing on a field.

But how would you indicate the context at index time as opposed to
query time? Especially at query time, there's very little in the way of
context to figure out what the category was.

Or were you thinking that the document had a category and applying
this only at index time?

Best
Erick

On Wed, Sep 19, 2012 at 3:23 PM, Carrie Coy <c...@ssww.com> wrote:
> Is there an existing TokenFilterFactory that can conditionally insert
> synonyms based on a given document attribute, say category? Some synonyms
> only make sense in context: "bats" in Sports is different from "bats" in
> "Party and Novelty".
>
> It seems the synonyms.txt file would need an additional column that could be
> checked against the document attribute prior to appending synonyms:
>
> *#synonyms            category*
> post,pole                sports
> wheel,caster           furniture
> pat,paddy,patrick   holiday
>
> Is anything like this possible without writing a custom TokenFilterFactory?

Reply via email to