public class LuceneTools
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
LuceneTools()
LuceneTools must not be instantiated directly.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected LuceneTools()
public static final void getTerms(org.apache.lucene.search.Query query, java.util.Hashtable terms, boolean prohibited) throws java.io.IOException
query
- Query to extract term texts fromterms
- 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 termjava.io.IOException
A utility method for getting a field name from a key of the hashtable for a value/term text
protected static final void getTermsFromBooleanQuery(org.apache.lucene.search.BooleanQuery query, java.util.Hashtable terms, boolean prohibited) throws java.io.IOException
query
- BooleanQuery to extract term texts fromterms
- HashSet where extracted term texts should be put into (Elements: String)prohibited
- true
to extract "prohibited" terms, toojava.io.IOException
protected static final void getTermsFromPhraseQuery(org.apache.lucene.search.PhraseQuery query, java.util.Hashtable terms)
query
- PhraseQuery to extract term texts fromterms
- HashSet where extracted term texts should be put into (Elements: String)protected static final void getTermsFromTermQuery(org.apache.lucene.search.TermQuery query, java.util.Hashtable terms)
query
- TermQuery to extract term texts fromterms
- HashSet where extracted term texts should be put into (Elements: String)protected static void getTermsFromTerm(org.apache.lucene.index.Term term, java.util.Hashtable terms)
term
- Term to extract term fromterms
- The hashtable to which the term information should be added, ie the field name and text for the term
TODO: is it here we have to control the field to decode a date ? [MP]public static java.lang.String getFieldNameFromKey(java.lang.String key)
Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.