|
DLESE Tools v1.6.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.dlese.dpc.index.VirtualSearchFieldMapper
public class VirtualSearchFieldMapper
Maps virtual search field/term pairs to Lucene Queries. For example, the field/term pair cats:cougar might
be mapped to the Lucene Query (cougar OR puma OR "mountain lion"). To define the mappings, the API can be
given one or more XML files that contain <virtualSearchField> elements that contain XML queries
parsed by the XMLQueryParser class. See sample XML file . Mappings
can also be added or removed directly using the API. The API returns Queries for the given field/term
pairs, and a FieldExpansionQueryParser may be used to apply the
field/term mappings when supplied in regular Lucene query strings.
FieldExpansionQueryParser,
XMLQueryParser| Constructor Summary | |
|---|---|
VirtualSearchFieldMapper(org.apache.lucene.queryParser.QueryParser parser)
Constructor for the VirtualSearchFieldMapper object |
|
| Method Summary | |
|---|---|
void |
addVirtualFieldConfiguration(File xmlConfigFile)
Adds all virtual field/term query definitions (virtualSearchField elements) contained in the given XML configuration file, replacing any previous definitions. |
void |
addVirtualFieldConfiguration(String xmlConfig)
Adds all virtual field/term query definitions (virtualSearchField elements) contained in the given XML configuration String, replacing any previous definitions. |
void |
addVirtualFieldConfiguration(URL xmlConfig)
Adds all virtual field/term query definitions (virtualSearchField elements) contained in the given XML configuration file, replacing any previous definitions. |
void |
clear()
Clears all field/term definitions that are defined. |
boolean |
getIsTermConfiguredForField(String virtualField,
String virtualTerm)
Determines whether the given virtual term is configured for the given field. |
int |
getNumTermsConfiguredForField(String virtualField)
Gets the number of virtual terms configured for a given virtual field. |
org.apache.lucene.search.Query |
getQuery(String virtualField,
String virtualTerm)
Gets the Lucene Query that is defined for the given virtual field/term pair, or null if none avaialable. |
String |
getQueryString(String virtualField,
String virtualTerm)
Gets the Lucene Query as a String for the given virtual field and term, or null if not avaialable. |
String[] |
getVirtualFields()
Gets the virtual fields that are defined. |
String[] |
getVirtualTerms(String field)
Gets the virtual terms that are defined for the given field, or null. |
boolean |
remove(String virtualField)
Removes all term definitions that are defined for the given field. |
boolean |
remove(String virtualField,
String virtualTerm)
Removes the definition that is defined for the given field and term. |
void |
setQuery(String virtualField,
String virtualTerm,
org.apache.lucene.search.Query query)
Sets the Query assigned for the given field and term, overwriting any previous definition. |
void |
setQuery(String virtualField,
String virtualTerm,
String query)
Sets the Query assigned for the given field and term, overwriting any previous definition. |
String |
toString()
Outputs a String representation of the fields/terms/queries that are defined in this VirtulSearchFieldMapper. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public VirtualSearchFieldMapper(org.apache.lucene.queryParser.QueryParser parser)
parser - The QueryParser used to parse Lucene queries that are defined in the configuration file| Method Detail |
|---|
public org.apache.lucene.search.Query getQuery(String virtualField,
String virtualTerm)
virtualField - The virtual search fieldvirtualTerm - The virtual search term
public String getQueryString(String virtualField,
String virtualTerm)
virtualField - The virtual search fieldvirtualTerm - The virtual search term
public int getNumTermsConfiguredForField(String virtualField)
virtualField - The virtual search field
public boolean getIsTermConfiguredForField(String virtualField,
String virtualTerm)
virtualField - The virtual search fieldvirtualTerm - The virtual search term
public void setQuery(String virtualField,
String virtualTerm,
org.apache.lucene.search.Query query)
virtualField - The fieldvirtualTerm - The termquery - The new Query value for this field/term
public void setQuery(String virtualField,
String virtualTerm,
String query)
throws org.apache.lucene.queryParser.ParseException
QueryParser Object that was passed into the constructor.
virtualField - The fieldvirtualTerm - The termquery - The new Query value for this field/term
org.apache.lucene.queryParser.ParseException - If error parsing the query String
public boolean remove(String virtualField,
String virtualTerm)
getQuery(java.lang.String, java.lang.String) or getQueryString(java.lang.String, java.lang.String) for this field/term pair will return null.
virtualField - The fieldvirtualTerm - The term
public boolean remove(String virtualField)
getQuery(java.lang.String, java.lang.String) or getQueryString(java.lang.String, java.lang.String) will return null for all references to this field.
virtualField - The field to remove
public void clear()
getQuery(java.lang.String, java.lang.String) or getQueryString(java.lang.String, java.lang.String) will return null for all calls.
public String[] getVirtualFields()
public String[] getVirtualTerms(String field)
field - The field
public void addVirtualFieldConfiguration(String xmlConfig)
throws Exception
xmlConfig - The VirtualSearchFieldMapper configuration XML string
Exception - If error parsing the String
public void addVirtualFieldConfiguration(File xmlConfigFile)
throws Exception
xmlConfigFile - The VirtualSearchFieldMapper configuration XML file
Exception - If error parsing or reading the file
public void addVirtualFieldConfiguration(URL xmlConfig)
throws Exception
xmlConfig - The URL to the VirtualSearchFieldMapper configuration XML file
Exception - If error parsing or reading the urlpublic String toString()
toString in class Object
|
DLESE Tools v1.6.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||