sdx-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE : [sdx-developers] Le highlighter de la mort


From: Rasik Pandey
Subject: RE : [sdx-developers] Le highlighter de la mort
Date: Fri, 19 Sep 2003 13:00:25 +0200

Salut,
 
 >Mon problème est là :
 >
 >while ((token = stream.next()) != null) {
 >
 >... va me renvoyer des tokens dont certains auront un un 
 >getPositionIncrement() égal à 0.
 >
 >Si mon analyse est bonne :
 >
 >else {
 >   char[] chars = tokenText.toCharArray();
 >   if (chars != null)
 >     this.xmlConsumer.characters(chars, 0, chars.length);
 >}
 >
 >Va donc me renvoyer *chaque* token qui n'est pas dans la "liste de 
 >termes" : this.terms (qui pourrait être renommée 
 >this.wantedHighlights 
 >?). 

Mais si tu le corrige du coté de la requête (QueryParser) toute tes
termes iraient apparaître dans cette liste.


 >Je vous recommande le résultat de cette manipulation : très 
 >impressionnant :-)
 >
 >En fait, je pense qu'il faudrait avoir ça :
 >
 >else {
 >   //Check whether this text has already been emitted
 >   if (token.getPositionIncrement() != 0) {
 >     char[] chars = tokenText.toCharArray();
 >     if (chars != null)
 >       this.xmlConsumer.characters(chars, 0, chars.length);
 >   }
 >}
 >

 >Est-ce que vous confirmez l'analyse ?
 >
 >Je dois avouer que je n'ai aucune idée de l'implication pour 
 >des tokens 
 >dont le getPositionIncrement() serait > 1. J'ai bien peur que chez 
 >Lucene, ça ne soit pas très clair non plus :-)

 >Je travaille sur un tokenizer qui, pour un token en entrée, peut en
renvoyer N en sortie. Evidemment, ces N tokens ont
 >les mêmes offsets que le token d'entrée. La seule différence, c'est
que le premier a un positionIncrement de 1 (cas 
 >standard) et les autres un positionIncrement de 0.


Tu l'as vu? Ça ne t'aide pas?:

/** Set the position increment.  This determines the position of this
token
   * relative to the previous Token in a address@hidden TokenStream}, used in
phrase
   * 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
stem's
   * increment should be set to zero: the increment of the first
instance
   * 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
matches.
   * If, for example, one does not want phrases to match across removed
stop
   * 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
each
   * non-stop word.  Then exact phrase queries will only match when the
terms
   * occur with no intervening stop words.
   *
   * </ul>
   * @see org.apache.lucene.index.TermPositions
   */
  public void setPositionIncrement(int positionIncrement) {
    if (positionIncrement < 0)
      throw new IllegalArgumentException
        ("Increment must be zero or greater: " + positionIncrement);
    this.positionIncrement = positionIncrement;
  }

Rasik





reply via email to

[Prev in Thread] Current Thread [Next in Thread]