edu.ucsb.nceas.metacat.advancedsearch

## Class AdvancedSearch

- java.lang.Object
- - edu.ucsb.nceas.metacat.advancedsearch.AdvancedSearch

-     public class AdvancedSearch
      extends java.lang.Object

  Author:
    dcosta AdvancedSearch class constructs queries that use the pathquery feature of Metacat. It can execute either an advanced search, where the user fills in fields in a web form, or a simple search on a string.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AdvancedSearch(AdvancedSearchBean advancedSearchBean)` Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `executeAdvancedSearch(java.lang.String metacatURL, Metacat metacat, java.lang.String qformat, java.lang.String xslPath)` Builds and runs an advanced search, returning HTML result string.
    `java.lang.String` | `executeSearch(java.lang.String metacatURL, Metacat metacat, java.lang.String qformat, java.lang.String xslPath, java.lang.String value)` Builds and runs a simple search, returning HTML result string.
    `static void` | `main(java.lang.String[] argv)` Main program to run a test query from the command line.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AdvancedSearch

          public AdvancedSearch(AdvancedSearchBean advancedSearchBean)

      Constructor. Used when the user has filled in an Advanced Search form. The property values are contained in the advancedSearchBean object. For a simple search, the advancedSearchBean object is passed as null.
      Parameters:
        `advancedSearchBean` - An AdvancedSearch bean.

  - ### Method Detail

    - #### executeAdvancedSearch

          public java.lang.String executeAdvancedSearch(java.lang.String metacatURL,
                                                        Metacat metacat,
                                                        java.lang.String qformat,
                                                        java.lang.String xslPath)

      Builds and runs an advanced search, returning HTML result string.
      Parameters:
        `metacatURL` - URL to the metacat servlet
        `metacat` - A metacat client object, possible null.
        `qformat` - The qformat (skin) to use when displaying results.
        `xslPath` - File path to the resultset.xsl stylesheet.
      Returns:
        htmlString HTML string representation of the search results.

    - #### executeSearch

          public java.lang.String executeSearch(java.lang.String metacatURL,
                                                Metacat metacat,
                                                java.lang.String qformat,
                                                java.lang.String xslPath,
                                                java.lang.String value)

      Builds and runs a simple search, returning HTML result string. For a simple search, the AdvancedSearchBean object can be null because all we need is a string value to search on.
      Parameters:
        `metacatURL` - URL to the metacat servlet
        `metacat` - A metacat client object, possible null.
        `qformat` - The qformat (skin) to use when displaying results.
        `xslPath` - File path to the resultset.xsl stylesheet.
        `value` - String value to search on.
      Returns:
        htmlString HTML string representation of the search results.

    - #### main

          public static void main(java.lang.String[] argv)

      Main program to run a test query from the command line. Pass the server name, server port, and path to resultset.xsl as the first three command line arguments:
      Parameters:
        `argv[0]` - The server name, e.g. "earth.lternet.edu"
        `argv[1]` - The server port, e.g. "8080", or 0 if no port needs to be specified.
        `argv[2]` - The context string, e.g. "knb"
        `argv[3]` - The path to the resultset.xsl stylesheet, e.g. "C:/Tomcat5/webapps/query/style/common/resultset.xsl"

Copyright © 2020 Regents of the University of California. All Rights Reserved.