lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Murzaku" <>
Subject RE: Indexing synonyms
Date Sun, 10 Nov 2002 23:17:14 GMT
You could also do something with org.apache.lucene.analyzer.Token which
includes the following self-explanatory note:

  /** Set the position increment.  This determines the position of this
   * relative to the previous Token in a {@link TokenStream}, used in
   * searching.
   * <p>The default value is one.
   * <p>Some common uses for this are:<ul>
   * <li>Set it to zero to put multiple terms in the same position.
This is
   * useful if, e.g., a word has multiple stems.  Searches for phrases
   * including either stem will match.  In this case, all but the first
   * increment should be set to zero: the increment of the first
   * should be one.  Repeating a token with an increment of zero can
also be
   * used to boost the scores of matches on that token.
   * <li>Set it to values greater than one to inhibit exact phrase
   * If, for example, one does not want phrases to match across removed
   * words, then one could build a stop word filter that removes stop
words and
   * also sets the increment to the number of stop words removed before
   * non-stop word.  Then exact phrase queries will only match when the
   * occur with no intervening stop words.
   * </ul>
   * @see TermPositions
  public void setPositionIncrement(int positionIncrement) {
    if (positionIncrement < 0)
      throw new IllegalArgumentException
        ("Increment must be positive: " + positionIncrement);
    this.positionIncrement = positionIncrement;

Alex Murzaku

-----Original Message-----
From: Otis Gospodnetic [] 
Sent: Sunday, November 10, 2002 1:30 PM
To: Lucene Users List
Subject: Re: Indexing synonyms

.mt?  Malta?  That's rare! :)

A person called Clemens Marschner just submitted diffs for query
rewriting to lucene-dev list 1-2 weeks ago.  The diffs are not in CVS
yet, and they are a bit old now becase the code they were made against
has changed since they were made. You could either try applying them
yourself, of waiting until they get applied and then you could get a
nightly build.


--- Aaron Galea <> wrote:
> Hi everyone,
> I need to create a filter that extends a tokenfilter whose purpose is 
> to generate some synonyms for words in the document using Wordnet. 
> Well searching for synonyms using wordnet is not that problematic but 
> I need to add the synonym words to Lucene tokenstream before they are 
> passed for indexing. However TokenStream class does not support any 
> add method. Did anyone ever needed to do this? Can someone suggest an 
> alternative of how to add some synonym words to the index?
> Thanks
> Aaron

Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message