|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.gsaapi.GSAQuery
Encapsulates the query parameters to be sent to the GSA. A typical use of this class would be:
... GSAQuery query = new GSAQuery(); GSAQueryTerm term = new GSAQuery.GSAQueryTerm("instrumental music"); term.setInTitle(new String[]{"music"}); // search for music in page title term.setIncludeFileType(new String[]{"pdf","html"}); // restrict to pdf and html file types query.setQueryTerm(term); query.setCollections(sites); // set the collection ofadmin-configured sites to restrict search to ...
GSAClient
Nested Class Summary | |
static class |
GSAQuery.GSAQueryTerm
This class is required because the GSA query term supports a "special term" syntax. |
Field Summary | |
static int |
MAX_RESULTS
the absolute maximum number of results that a query can generate. |
static int |
MAX_RESULTS_PER_QUERY
The maximum number of results to be fetched in one invokation of a query. |
Constructor Summary | |
GSAQuery()
create an instance of GSAQuery. |
Method Summary | |
java.lang.String |
getQueryString()
This method is mainly to facilicate automated testing. |
java.lang.String |
getValue()
return the HTTP GET query string. |
void |
setAccess(Access access)
restrict results to public or secure (or do not restrict) based on the value of the Access parameter. |
void |
setAndQueryTerms(java.lang.String[] andTerms)
restrict search to documents containing all of the specified terms. |
void |
setExactPhraseQueryTerm(java.lang.String phrase)
search for the documents containing the exact specified phrase. |
void |
setFetchMetaFields(java.lang.String[] fields)
Fetch specified META tags if they exist in the document. |
void |
setFilter(Filter filter)
Set the filter char code that indicates type of filtering to be performed. |
void |
setFrontend(java.lang.String frontend)
A string representing any valid frontend. |
void |
setInputEncoding(java.lang.String inputEncoding)
Set input encoding (advanced use only) |
void |
setLanguage(java.lang.String language)
Restrict search to pages in specified languages only. |
void |
setMaxResults(int maxResults)
Restrict search results to these many at most. |
void |
setNumKeyMatches(byte keyMatches)
Number of keymatches in a document (max value accepted by GSA is 5). |
void |
setOrQueryTerms(java.lang.String[] orTerms)
search documents containing any or all of specified terms. |
void |
setOutputEncoding(java.lang.String outputEncoding)
Set output encoding (advanced use only) |
void |
setOutputFormat(OutputFormat of)
|
void |
setPartialMetaFields(java.util.Properties partialFields)
Calls setPartialMetaFields(Properties, boolean) with the
boolean argument set to true . |
void |
setPartialMetaFields(java.util.Properties partialFields,
boolean orIfTrueAndIfFalse)
Set the meta fields based filtering criteria. |
void |
setProxycustom(java.lang.String proxycustom)
sets the proxycustom url param. |
void |
setProxyReload(boolean force)
Setting this to true forces reloading of the proxystylesheet by the GSA server. |
void |
setProxystylesheet(java.lang.String proxystylesheet)
set the value for proxystylesheet. |
void |
setQueryTerm(GSAQuery.GSAQueryTerm queryTerm)
|
void |
setRequiredMetaFields(java.util.Properties requiredFields)
Calls setRequiredMetaFields(Properties, boolean) with the
boolean argument set to true . |
void |
setRequiredMetaFields(java.util.Properties requiredFields,
boolean orIfTrueAndIfFalse)
Set the meta fields based filtering criteria. |
void |
setScrollAhead(int n)
scroll ahead to display (n+1)th result as the first result. |
void |
setSearchScope(SearchScope searchScope)
Indicate part of page to which the search is to be restricted. |
void |
setSiteCollections(java.lang.String[] siteCollections)
Restrict search to exclude documents from specified "siteCollections". |
void |
setSortByDate(boolean asc,
char mode)
sort by date (default sorted by "relevance") and in the specified sort-direction and mode If this method is invoked, the returned results also contain a custom field named "date" with the date value specified in YYYY-MM-DD formatted string. |
void |
unsetSortByDate()
This method removes any sort-value set by previous calls to setSortByDate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAX_RESULTS
public static final int MAX_RESULTS_PER_QUERY
setMaxResults(int)
.
Constructor Detail |
public GSAQuery()
Method Detail |
public void setSiteCollections(java.lang.String[] siteCollections)
siteCollection
is not the same as an internet domain name -
generally a siteCollection
is mapped to a set of domain names.
siteCollections
- public void setFrontend(java.lang.String frontend)
frontend
- public void setOutputFormat(OutputFormat of)
of
- The OutputFormat enum valueOutputFormat
public void setMaxResults(int maxResults)
maxResults
- maximum results desired. Large values will be limited to
MAX_RESULTS
public void setNumKeyMatches(byte keyMatches)
keyMatches
- number of keyMatches desiredpublic void setSearchScope(SearchScope searchScope)
searchScope
- A SearchScope
enum value.public void setFilter(Filter filter)
filter
- A Filter
enum valuepublic void setQueryTerm(GSAQuery.GSAQueryTerm queryTerm)
queryTerm
- The GSAQuery.GSAQueryTerm
instance encapsulating the query string.public void setOrQueryTerms(java.lang.String[] orTerms)
orTerms
- Terms that will be used to match the results documents.
Documents matching any of the terms in the String array will
be returned. Note that the terms will be further tokenized on
spaces. String[] str1 = new String[] { "this", "that" }; String[] str2 = new String[] { "this that" };Using either of the above String arrays as an argument will yield same results.
public void setAndQueryTerms(java.lang.String[] andTerms)
andTerms
- Terms that will be used to match the results documents. Only
documents matching all of the terms in the String array will
be returned. Note that the terms will be further tokenized on
spaces. String[] str1 = new String[] { "this", "that" }; String[] str2 = new String[] { "this that" };Using either of the above String arrays as an argument will yield same results.
public void setExactPhraseQueryTerm(java.lang.String phrase)
phrase
- The exact phrase to search for.public void setInputEncoding(java.lang.String inputEncoding)
inputEncoding
- The input encoding.public void setOutputEncoding(java.lang.String outputEncoding)
outputEncoding
- The output encoding.public void setLanguage(java.lang.String language)
language
- The language.public void setFetchMetaFields(java.lang.String[] fields)
fields
- The meta fields associated with a result to fetch.public void setRequiredMetaFields(java.util.Properties requiredFields)
setRequiredMetaFields(Properties, boolean)
with the
boolean argument set to true
.
requiredFields
- The Properties
object encapsulating
the required field names and values.public void setRequiredMetaFields(java.util.Properties requiredFields, boolean orIfTrueAndIfFalse)
Note: The name and value strings must be url encoded.
requiredFields
- The Properties instance specifying the required fields filter.
All keys and values in the properties instance must be url
encoded.orIfTrueAndIfFalse
- If true, the required field constraints are ORed -- ie.
results containing any of the required fields are retrieved.
If false, the required field contraints are ANDed ie. only
results containing all the results are returned.public void setPartialMetaFields(java.util.Properties partialFields)
setPartialMetaFields(Properties, boolean)
with the
boolean argument set to true
.
partialFields
- public void setPartialMetaFields(java.util.Properties partialFields, boolean orIfTrueAndIfFalse)
partialFields
- The Properties instance specifying the partial fields filter.orIfTrueAndIfFalse
- If true, the required field constraints are ORed -- ie.
results containing any of the required fields are retrieved.
If false, the required field contraints are ANDed ie. only
results containing all the results are returned.public void setSortByDate(boolean asc, char mode)
asc
- true if desired sort-direction is ascending. false otherwise.mode
- mode can be one of 'S' 'R' 'L' to mean "Sort relevant
results", "Sort all results", "Dont sort, fetch date for each
result " respectively.public void unsetSortByDate()
public void setScrollAhead(int n)
n
- the starting index (0-based). ie. The (n+1)th result will be
the first result to be displayed.public void setAccess(Access access)
access
- The Access enum value.Access
public void setProxycustom(java.lang.String proxycustom)
proxycustom
- proxycustom string value.public void setProxystylesheet(java.lang.String proxystylesheet)
proxystylesheet
- proxystylesheet String value.public void setProxyReload(boolean force)
force
- true forces reloading the proxystylesheet for the results of
this search.public java.lang.String getValue()
public java.lang.String getQueryString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
© Copyright 2006 Inxight Software, Inc.