net.sf.gsaapi
Class GSAQuery.GSAQueryTerm

java.lang.Object
  extended bynet.sf.gsaapi.GSAQuery.GSAQueryTerm
Enclosing class:
GSAQuery

public static class GSAQuery.GSAQueryTerm
extends java.lang.Object

This class is required because the GSA query term supports a "special term" syntax. For example, when interacting with a GSA using a browser, the user can specify: instrumental music intitle:edu filetype:pdf OR filetype:html Which means that the user wants to search for PDF or HTML documents having "edu" in their title and containing both "instrumental" and "music" in the document contents. This class models these special query term semantics by providing an attribute for each type of special term.


Constructor Summary
GSAQuery.GSAQueryTerm()
           
GSAQuery.GSAQueryTerm(java.lang.String queryString)
          Search for all the words specified in the query string (words are whitespace delimited in the string)
 
Method Summary
 GSAQuery.GSAQueryTerm addFileType(java.lang.String term, boolean include)
          Add a term to filetypes inclusion/exclusion list.
 GSAQuery.GSAQueryTerm addInTitle(java.lang.String term, boolean include)
          add a term to titles inclusion/exclusion list.
 GSAQuery.GSAQueryTerm addInUrl(java.lang.String term, boolean include)
          add a term to url inclusion/exclusion list.
 void setAllInTitle(java.util.List allInTitleTerms)
          all the terms specified must be in the page title.
 void setAllInUrl(java.util.List allInUrlTerms)
          all the terms specified must be in the page url.
 void setCachedDocument(java.lang.String docLocation)
          search for cached document at specified location.
 void setDateRange(long fromDateInJulianDays, long toDateInJulianDays)
          set a daterange filter.
 void setExcludeFileType(java.util.List filetype)
          Exclude documents with specified file extensions.
 void setIncludeFileType(java.util.List filetype)
          Restrict search to specified file extensions.
 void setInTitle(java.util.List inTitleTerms)
          search for the specified strings in title.
 void setInUrl(java.util.List inUrlTerms)
          search for the specified strings in url.
 void setNotInTitle(java.util.List notInTitleTerms)
          remove results that contain specified terms in title
 void setNotInUrl(java.util.List notInUrlTerms)
           
 void setQueryString(java.lang.String queryString)
          set the queryString.
 void setSite(java.lang.String site, boolean include)
          Set the site (domain) for inclusion or exclusion.
 void setWebDocument(java.lang.String docLocation)
          search for document at specified location.
 void setWithLinksTo(java.lang.String link)
          search for documents linking to specified document (url string).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GSAQuery.GSAQueryTerm

public GSAQuery.GSAQueryTerm(java.lang.String queryString)
Search for all the words specified in the query string (words are whitespace delimited in the string)

Parameters:
queryString -

GSAQuery.GSAQueryTerm

public GSAQuery.GSAQueryTerm()
Method Detail

setQueryString

public void setQueryString(java.lang.String queryString)
set the queryString. Calling the no-arg constructor followed by call to this method is equivalent to calling the one-arg constructor with this argument. This method is useful if you want to reuse the same GSAQueryTerm object for making multiple queries.

Parameters:
queryString -

setInTitle

public void setInTitle(java.util.List inTitleTerms)
search for the specified strings in title.

Parameters:
inTitleTerms -

setNotInTitle

public void setNotInTitle(java.util.List notInTitleTerms)
remove results that contain specified terms in title

Parameters:
notInTitleTerms -

addInTitle

public GSAQuery.GSAQueryTerm addInTitle(java.lang.String term,
                                        boolean include)
add a term to titles inclusion/exclusion list. If the boolean param is true, term is added to inclusion list, else added to exclusion list.

Parameters:
term - String to include/exclude
include - true means include, false means exclude
Returns:
The current GSAQueryTerm instance to allow chaining of multiple calls as so: gsaQueryTerm.addFileType("pdf", true).addFileType("html", true);

setAllInTitle

public void setAllInTitle(java.util.List allInTitleTerms)
all the terms specified must be in the page title. No other properties of this instance may be set if this property is set.

Parameters:
allInTitleTerms -

setInUrl

public void setInUrl(java.util.List inUrlTerms)
search for the specified strings in url.

Parameters:
inUrlTerms -

setNotInUrl

public void setNotInUrl(java.util.List notInUrlTerms)

addInUrl

public GSAQuery.GSAQueryTerm addInUrl(java.lang.String term,
                                      boolean include)
add a term to url inclusion/exclusion list. If the boolean param is true, term is added to inclusion list, else added to exclusion list.

Parameters:
term - String to include/exclude
include - true means include, false means exclude
Returns:
The current GSAQueryTerm instance to allow chaining of multiple calls as so: gsaQueryTerm.addFileType("pdf", true).addFileType("html", true);

setAllInUrl

public void setAllInUrl(java.util.List allInUrlTerms)
all the terms specified must be in the page url. No other properties of this instance may be set if this property is set.

Parameters:
allInUrlTerms -

setIncludeFileType

public void setIncludeFileType(java.util.List filetype)
Restrict search to specified file extensions. Commonly used values are: "pdf", "html", "doc".

Parameters:
filetype - The filetypes to restrict the search to.

setExcludeFileType

public void setExcludeFileType(java.util.List filetype)
Exclude documents with specified file extensions.

Parameters:
filetype - The filetypes to exclude from the search.

addFileType

public GSAQuery.GSAQueryTerm addFileType(java.lang.String term,
                                         boolean include)
Add a term to filetypes inclusion/exclusion list. If the boolean param is true, term is added to inclusion list, else added to exclusion list.

Parameters:
term - String to include/exclude.
include - true means include, false means exclude.
Returns:
The current GSAQueryTerm instance to allow chaining of multiple calls as so: gsaQueryTerm.addFileType("pdf", true).addFileType("html", true);

setSite

public void setSite(java.lang.String site,
                    boolean include)
Set the site (domain) for inclusion or exclusion. As per the GSA documentation, only one site (domain) can be included or excluded. To remove a previously set site, simply call: setSite(null, false) OR setSite(null, true) (The boolean parameter is ignored if the String parameter is null)
NOTE: This has been modified since v1.4 of the GSA-JAPI. Previous versions of the API allowed you to set multiple sites for inclusion and/or exclusion. However, as per GSA documentation, only one site should be specified for inclusion or exclusion.

Parameters:
site - The site/domain name as a string
include - Whether to use the site as an inclusion filter (if true) or exclusion filter (if false)

setWebDocument

public void setWebDocument(java.lang.String docLocation)
search for document at specified location. No other properties of this instance may be set if this property is set.

Parameters:
docLocation -

setCachedDocument

public void setCachedDocument(java.lang.String docLocation)
search for cached document at specified location. No other properties of this instance may be set if this property is set.

Parameters:
docLocation -

setWithLinksTo

public void setWithLinksTo(java.lang.String link)
search for documents linking to specified document (url string). The specified document must be accessible to the GSA. eg. usage: link:www.mysite.net/path/somedoc.html

Parameters:
link -

setDateRange

public void setDateRange(long fromDateInJulianDays,
                         long toDateInJulianDays)
set a daterange filter. Only documents that have the associated date within the specified range will be retrieved.
NOTE: Date range filter is not a well-documented feature and a particular installation of GSA may or may not support filtering by date range. Please ensure that the target GSA supports the "daterange:-" query filter before using this method. (where and are julian dates. See also: Util.toJulian(java.util.Date)

Parameters:
fromDateInJulianDays - The begin date (as a Julian Day Number) for the date range.
toDateInJulianDays - The end date (as a Julian Day Number) for the date range.


© Copyright 2006 Inxight Software, Inc.