|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.action.Action org.dlese.dpc.dds.action.DDSQueryAction
public final class DDSQueryAction
A Struts Action for handling display of resource record descriptions, and their various collection info.
Field Summary | |
---|---|
static String[] |
ENCODED_FIELDS
A list of all fields that are indexed in encoded form via SimpleLuceneIndex.encodeToTerm() |
static String[][] |
FIELD_ALIASES
A list of aliases that map user-typed field names to the field name that exists in the index. |
static int |
OPERATOR_AND
Indicates use of the AND boolean operator in the getBooleanQuery(String[] terms, int operator,
boolean useStemming) method. |
static int |
OPERATOR_OR
Indicates use of the OR boolean operator in the getBooleanQuery(String[] terms, int operator,
boolean useStemming) method. |
static String[] |
SEARCH_TYPE_NAMES
Identifiers that get printed in the query/search logs |
static int |
SEARCHTYPE_DDSWS_SEARCH
Indicates web service search by client using general search request |
static int |
SEARCHTYPE_DDSWS_USER_SEARCH
Indicates web service search by client using user search request |
static int |
SEARCHTYPE_GENERAL_RSS
Indicates an RSS general request |
static int |
SEARCHTYPE_HISTOGRAM
Indicates histogram search by user |
static int |
SEARCHTYPE_JSHTML_SEARCH
Indicates a JSHTML service search |
static int |
SEARCHTYPE_ODL_SEARCH
Indicates web service search by client using the ODL request |
static int |
SEARCHTYPE_SEARCH
Indicates textual search by user |
static int |
SEARCHTYPE_WHATSNEW
Indicates whats new search by user |
static int |
SEARCHTYPE_WHATSNEW_RSS
Indicates an RSS whats new request |
Fields inherited from class org.apache.struts.action.Action |
---|
defaultLocale, servlet |
Constructor Summary | |
---|---|
DDSQueryAction()
|
Method Summary | |
---|---|
static String |
addConstraintToQuery(String query,
String constraintQuery)
Adds a feature to the ConstraintToQuery attribute of the DDSQueryAction class |
static DDSStandardSearchResult |
ddsStandardQuery(HttpServletRequest request,
String additionalQueryOrConstraint,
RepositoryManager rm,
MetadataVocab vocab,
ServletContext context,
int searchType)
Performs textual and field-based searches limited to discoverable items only and using pre-defined search logic. |
org.apache.struts.action.ActionForward |
execute(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
Processes the specified HTTP request and creates the corresponding HTTP response by forwarding to a JSP that will create it. |
static StringBuffer |
formatEncodedFields(String q)
Encodes a query string such that each term that is part of a field that has been encoded in the index using SimpleLuceneIndex .encodeToTerm() is replaced with the encoded form for
searching. |
static String |
formatFieldsInQuery(String q)
Formats the fields/terms in the query string by replacing the aliased field names and encoding terms that are in fields that have been indexed encoded. |
static String |
getBooleanQuery(String[] terms,
int operator,
boolean useStemming)
Creates a boolean query string for use in the standard Lucene query parser. |
static String |
getCollectionQueryTerm(String ky)
Gets the Lucene query string necessary to pull out records for a given collection. |
static org.apache.lucene.search.Query |
getGeospatialQuery(HttpServletRequest request)
Generates a geospatial bounding box Lucene Query from the necessary parameteres in an http request, which are geoPredicate, geoBBNorth, geoBBWest, geoBBEast, geoBBSouth. |
static HashMap |
getStopWordMap()
Gets the stopWordMap attribute of the DDSQueryAction class |
static String |
getVocabParamsQueryString(HttpServletRequest request,
MetadataVocab vocab,
HashMap docReaderAttributes)
Gets a query that limits a search to vocab-managed fields such as gradeRange (gr), resourceType (re), subject (su), contentStandard (cs) and collection (ky). |
static org.apache.lucene.search.Filter |
getWhatsNewDateFilter(String wnfrom,
String wnto)
Gets the whatsNewDateFilter attribute of the DDSQueryAction class |
org.apache.struts.action.ActionForward |
handleMetadataSearchRequest(org.apache.struts.action.ActionMapping mapping,
DDSQueryForm queryForm,
HttpServletRequest request,
HttpServletResponse response,
RepositoryManager rm)
Handle a request to search over metadata collections and forwared to the appropriate jsp page to render the response. |
static boolean |
logQuery(String query,
ServletContext servletContext,
HttpServletRequest request,
int statusCode,
int contentLen,
int numSearchResults,
int totalRecords,
int rank,
int searchType)
This method must be called at just after the user's query has been processed by Lucene. |
static String |
replaceAliasedFieldNames(String q)
Substitutues the searchable field names for the common field names that user's may use in their query string. |
static void |
setDebug(boolean isDebugOutput)
Sets the debug attribute of the DDSQueryAction class |
Methods inherited from class org.apache.struts.action.Action |
---|
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int OPERATOR_AND
getBooleanQuery(String[] terms, int operator,
boolean useStemming)
method.
public static final int OPERATOR_OR
getBooleanQuery(String[] terms, int operator,
boolean useStemming)
method.
public static final int SEARCHTYPE_SEARCH
public static final int SEARCHTYPE_HISTOGRAM
public static final int SEARCHTYPE_WHATSNEW
public static final int SEARCHTYPE_DDSWS_USER_SEARCH
public static final int SEARCHTYPE_DDSWS_SEARCH
public static final int SEARCHTYPE_ODL_SEARCH
public static final int SEARCHTYPE_GENERAL_RSS
public static final int SEARCHTYPE_WHATSNEW_RSS
public static final int SEARCHTYPE_JSHTML_SEARCH
public static final String[] SEARCH_TYPE_NAMES
public static final String[] ENCODED_FIELDS
public static final String[][] FIELD_ALIASES
Constructor Detail |
---|
public DDSQueryAction()
Method Detail |
---|
public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
SimpleLuceneIndex
must be available to this class via
a ServletContext attribute under the key "index." Returns an ActionForward
instance that maps to the Struts forwarding name "simple.query,"
which must be configured in struts-config.xml to forward to the JSP page that will handle the request.
execute
in class org.apache.struts.action.Action
mapping
- The ActionMapping used to select this instancerequest
- The HTTP request we are processingresponse
- The HTTP response we are creatingform
- The ActionForm for the given page
IOException
- if an input/output error occurs
ServletException
- if a servlet exception occurspublic org.apache.struts.action.ActionForward handleMetadataSearchRequest(org.apache.struts.action.ActionMapping mapping, DDSQueryForm queryForm, HttpServletRequest request, HttpServletResponse response, RepositoryManager rm) throws IOException, ServletException
mapping
- The ActionMapping used to select this instancerequest
- The HTTP request we are processingresponse
- The HTTP response we are creatingrm
- queryForm
-
IOException
- if an input/output error occurs
ServletException
- if a servlet exception occurspublic static DDSStandardSearchResult ddsStandardQuery(HttpServletRequest request, String additionalQueryOrConstraint, RepositoryManager rm, MetadataVocab vocab, ServletContext context, int searchType)
request
- The HTTP requestrm
- The RepositoryManagervocab
- The MetadataVocabcontext
- The ServletContextsearchType
- The searchType that gets loggedadditionalQueryOrConstraint
- If the q parameter is empty, this value will be used as the search
query, if q is not empty this value will be ANDed with it
public static final String addConstraintToQuery(String query, String constraintQuery)
query
- The feature to be added to the ConstraintToQuery attributeconstraintQuery
- The feature to be added to the ConstraintToQuery attribute
public static org.apache.lucene.search.Query getGeospatialQuery(HttpServletRequest request) throws Exception
request
- An http request that may contain geospatial parameters
Exception
- If there is an error with one or more of the geospatial parameterspublic static final String getVocabParamsQueryString(HttpServletRequest request, MetadataVocab vocab, HashMap docReaderAttributes)
request
- The HTTP requestvocab
- The metadata vocab useddocReaderAttributes
- The doc reader attributes
public static final org.apache.lucene.search.Filter getWhatsNewDateFilter(String wnfrom, String wnto) throws ParseException
wnfrom
- The from datewnto
- The to date
ParseException
- If error parsingpublic static String getCollectionQueryTerm(String ky)
ky
- The vocab key, for example 06
public static HashMap getStopWordMap()
public static final String formatFieldsInQuery(String q)
q
- The raw query by user
public static final StringBuffer formatEncodedFields(String q)
SimpleLuceneIndex
.encodeToTerm() is replaced with the encoded form for
searching. May be used in conjuction with replaceAliasedFieldNames(String)
.
Examples:
'id:DLESE-000-000-000-001' becomes 'id:dlesex45000x45000x45000x45001'
'ocean AND urlenc:(http://*.noaa.gov* OR http://*.nasa.gov*)' becomes 'ocean AND
urlenc:(httpx58x47x47*x46noaax46gov* OR httpx58x47x47*x46nasax46gov*)'
q
- A query string
public static final String replaceAliasedFieldNames(String q)
formatEncodedFields(String)
.
Examples:
'url:http://*.noaa.gov*' becomes 'urlenc:http://*.noaa.gov*'
q
- A query from a user
public static final String getBooleanQuery(String[] terms, int operator, boolean useStemming)
terms
- The terms used in the query.operator
- The operator to use (AND|OR).useStemming
- True to stem the tersm, false to leave unchanged.
public static final boolean logQuery(String query, ServletContext servletContext, HttpServletRequest request, int statusCode, int contentLen, int numSearchResults, int totalRecords, int rank, int searchType)
query
- The text query entered by the user or submitted by the web service client, or
null if none was submitted with the requeststatusCode
- The http status codecontentLen
- The length of the data returned, in bytesnumSearchResults
- The number of search results returned by the querytotalRecords
- The total number of records in the system at the time of the queryrank
- The rank of the item(s) retunred on the page. If this is a results page, then
this is rank of the first item on the page.servletContext
- The servletContextrequest
- The HTTP requestsearchType
- The search type (search, histogram, what's new, ws-uql, ws-lql, etc)
public static void setDebug(boolean isDebugOutput)
isDebugOutput
- The new debug value
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |