Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## fr.gouv.culture.sdx.utils.lucene
Class LuceneTools

    java.lang.Object
      fr.gouv.culture.sdx.utils.lucene.LuceneTools

public class LuceneTools
extends java.lang.Object

Contains miscellaneous utility methods for use with Lucene.

Version:
  $Id: LuceneTools.java,v 1.9 2004/06/16 10:13:21 larcaini Exp $
Author:
  Maik Schreiber (mailto: bZ@iq-computing.de)

Constructor Summary
`protected` | `LuceneTools()` LuceneTools must not be instantiated directly.

Method Summary
`static java.lang.String` | `getFieldNameFromKey(java.lang.String key)`
`static void` | `getTerms(org.apache.lucene.search.Query query, java.util.Hashtable terms, boolean prohibited)` Extracts all term texts of a given Query.
`protected static void` | `getTermsFromBooleanQuery(org.apache.lucene.search.BooleanQuery query, java.util.Hashtable terms, boolean prohibited)` Extracts all term texts of a given BooleanQuery.
`protected static void` | `getTermsFromPhraseQuery(org.apache.lucene.search.PhraseQuery query, java.util.Hashtable terms)` Extracts all term texts of a given PhraseQuery.
`protected static void` | `getTermsFromTerm(org.apache.lucene.index.Term term, java.util.Hashtable terms)` Extracts the term of a given Term.
`protected static void` | `getTermsFromTermQuery(org.apache.lucene.search.TermQuery query, java.util.Hashtable terms)` Extracts all term texts of a given TermQuery.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LuceneTools

    protected LuceneTools()

  LuceneTools must not be instantiated directly.

Method Detail

### getTerms

    public static final void getTerms(org.apache.lucene.search.Query query,
                                      java.util.Hashtable terms,
                                      boolean prohibited)
                               throws java.io.IOException

  Extracts all term texts of a given Query. Term texts will be returned in lower-case.

  Parameters:
    `query` - Query to extract term texts from
    `terms` - HashTable where extracted term texts should be put into (see below for Hashtable storage format)
    `prohibited` - `true` to extract "prohibited" terms, too Terms texts will be stored as values in the provided hashtable with the keys in the format fieldName_termText as multiple terms can come from one field and multiple fields can have the same term
  Throws:
    `java.io.IOException`
  See Also:
    `A utility method for getting a field name from a key of the hashtable for a value/term text`

### getTermsFromBooleanQuery

    protected static final void getTermsFromBooleanQuery(org.apache.lucene.search.BooleanQuery query,
                                                         java.util.Hashtable terms,
                                                         boolean prohibited)
                                                  throws java.io.IOException

  Extracts all term texts of a given BooleanQuery. Term texts will be returned in lower-case.

  Parameters:
    `query` - BooleanQuery to extract term texts from
    `terms` - HashSet where extracted term texts should be put into (Elements: String)
    `prohibited` - `true` to extract "prohibited" terms, too
  Throws:
    `java.io.IOException`

### getTermsFromPhraseQuery

    protected static final void getTermsFromPhraseQuery(org.apache.lucene.search.PhraseQuery query,
                                                        java.util.Hashtable terms)

  Extracts all term texts of a given PhraseQuery. Term texts will be returned in lower-case.

  Parameters:
    `query` - PhraseQuery to extract term texts from
    `terms` - HashSet where extracted term texts should be put into (Elements: String)

### getTermsFromTermQuery

    protected static final void getTermsFromTermQuery(org.apache.lucene.search.TermQuery query,
                                                      java.util.Hashtable terms)

  Extracts all term texts of a given TermQuery. Term texts will be returned in lower-case.

  Parameters:
    `query` - TermQuery to extract term texts from
    `terms` - HashSet where extracted term texts should be put into (Elements: String)

### getTermsFromTerm

    protected static void getTermsFromTerm(org.apache.lucene.index.Term term,
                                           java.util.Hashtable terms)

  Extracts the term of a given Term. The term will be returned in lower-case.

  Parameters:
    `term` - Term to extract term from
    `terms` - The hashtable to which the term information should be added, ie the field name and text for the term

### getFieldNameFromKey

    public static java.lang.String getFieldNameFromKey(java.lang.String key)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.