To me, it's really a question of where the work should be done given your problem space. Injecting synonyms at index time allows the queries to be simpler/faster. Injecting the synonyms at query time gets complex but is more flexible.
As always, it's a time/space tradeoff. If you're willing to pay the space penalty for increased query speed, inject at index time. Otherwise you can inject at query time. And the query-time injection performance hit may not be trivial. Consider, for instance, span queries. Do you want to pay the price at query time for, say a BooleanQuery that is composed of 5 SpanQueries where each term in each SpanQuery consists of several OR clauses because of synonym injection? Perhaps you do and perhaps you don't. It all depends upon what your data looks like and what your performance criteria are. And you can do other tricks. Consider rather than indexing all the terms, only index the canonical term. That is, consider "hit" and the synonyms "strike", "popular", "punch". you could index "hit" for any of the 4 terms, then do the same substitution for your query. Which would make your index smaller *and* your queries faster. But you're right. Injecting synonyms at index time really requires a fixed synonym list that doesn't vary by user. So if you want synonym lists on a per-user basis, you're probably going to have to inject synonyms at query time. Best Erick On Jan 25, 2008 9:46 AM, Ravish Bhagdev <[EMAIL PROTECTED]> wrote: > Yes, I'm fairly new as well. > > So do you mean adding words to the query effectively doing an "or" > between synonymous terms? That sounds simple way of doing it, if this > works, what makes indexing with synonyms useful? > > Ravish > > On Jan 25, 2008 2:42 PM, Jon Lehto <[EMAIL PROTECTED]> wrote: > > Hi Ravish, > > > > You may want to think about the synonym dictionary as being a tool on > the side, rather than each indexed document having a copy of the synonyms. > At indexing time, one might normalize synonyms to a single value, and at > query time do the same to get the match. > > > > Alternately, use the synonym dictionary at run-time to expand a > > user's query terms, like a thesaurus. > > > > That said, I'm new to the tool, and not clear on how synonyms are > implemented. > > > > Jon > > ===================== > > From: Ravish Bhagdev <[EMAIL PROTECTED]> > > Date: 2008/01/25 Fri AM 08:24:33 CST > > To: solr-user@lucene.apache.org > > Subject: Is it possible to add synonyms run time? > > > > > > As I understood from available documentation, synonyms need to be > > defined before starting the indexing process. Is it possible to add > > synonyms at run time such that all index fields of all documents get > > updated? Does it work for newly added documents atleast? > > > > Also, how to make each user of application define his own set of > > synonyms that others should be oblivious to (others get normal results > > without synon considered) > > > > Thanks, > > Ravish > > > > >