:title: Creating a Search
:type: subUsing
:status: published
:parent: Searching {catalog-ui}
:summary: Creating Searches
:order: 00

== {title}

Search queries are grouped together into <<{using-prefix}using_workspaces,Workspaces>>.
These searches can be saved, edited, and duplicated as the basis of further searches.

.Creating a New Search Within the Current Workspace
. From the main {catalog-ui} screen, select *Search {catalog-ui}*.
.. From the dialog that opens, select the *edit* icon to name the search to reuse or share it.
.. Select the <<{using-prefix}search_types,type>> of search to perform: *Text*, *Basic*, or *Advanced*.
. Results are displayed in the *Search Tab*.
. If too many or too few results are returned, edit the search parameters by selecting the *edit* icon.
. Once the search is correct, select the *Save* icon next to the workspace name in the top bar.

.Creating a New Search Into a New Workspace
. Select the navigation menu icon.
. Select *Workspaces*.
. Enter search terms into the *Search* box.
. A new workspace, by default called *New Workspace*, is created containing only the new search.
. Rename the workspace, if desired.
. Select the *Save* icon next to the workspace name.

.Search Types[[_search_types]]
[no-bullet]
* *Text*: Perform a minimal textual search that is treated identically to a Basic search with only <<_text_search_details,Text>> specified.
* *Basic*: [[_basic_search]](((Basic Search Tool)))Define a <<_text_search_details,Text>>, <<_temporal_search_details,Temporal>>, <<_spatial_search_details,Spatial>>, or <<_type_search_details,Type>> Search.
[no-bullet]
** [[_text_search_details]]((*Text Search)) Details*: Searches across all textual data of the targeted data source. Text search capabilities include:
[no-bullet]
*** Search for an exact word, such as `Text = apple` : Returns items containing the word `"apple"` but not `"apples"`. Matching occurs on word boundaries.
*** Search for the existence of items containing multiple words, such as `Text = apple orange` : Returns items containing both "apple" and "orange" words. Words can occur anywhere in an item's metadata.
*** Search using wildcards, such as `Text = foo*` : Returns items containing words like `"food"`, `"fool"`, etc..
*** Wildcards should only be used for single word searches, not for phrases.
[WARNING]
When searching with wildcards, do not include the punctuation at the beginning or the end of a word. For example, search for `Text = ca*` instead of `Text = -ca*` when searching for words like `"cat"`, `"-cat"`, etc..  and search for `Text = *og` instead of `Text = *og.` when searching for words like `"dog"`, `"dog."`, etc..
*** Text searches are by default case insensitive, but case sensitive searches are an option.
+
** [[_temporal_search_details]]((*Temporal Search)) Details*: Search based on absolute time of the created, modified, or effective date.
[no-bullet]
*** *Any*: Search without any time restrictions (default).
*** *After*: Search records after a specified time.
*** *Before*: Search records before a specified time.
*** *Between*: Set an exclusive beginning and an exclusive end time to search between.
*** *Relative*: Search records relative to the current time.
+
** [[_spatial_search_details]]((*Spatial Search)) Details*
[no-bullet]
*** Search by latitude/longitude (decimal degrees or degrees minutes seconds), USNG/MGRS, or UTM
*** Search by entering a *Keyword* for a region, country, or city in the *Location* section of the query builder.
*** To search using a line, polygon, point-radius, or bounding box, select the shape to draw, then select *Draw*.
+
.Intersecting Polygon Searchs
[NOTE]
====
If a self intersecting polygon is used to perform a geographic search, the polygon is converted into a non-intersection one via a convex hull conversion. In the following example, the blue line shows the original self intersecting search polygon and the red line shows the converted polygon that is used for the search. The blue dot shows a search result that was not within the original polygon but was returned because it was within the converted polygon.

.Self Intersecting Polygon Conversion Example
image::convex-hull-transform-example.png[]
====
+
** [[_type_search_details]]*Type Search Details*
[no-bullet]
*** Search for specific content types.
+
* *Advanced*: ((Advanced Query Builder)) can be used to create more specific searches than can be done through the other methods.
[no-bullet]
** [[_advanced_query_builder]]*Advanced Query Builder Details*
[no-bullet]
*** *Operator*: If 'AND' is used, all the filters in the branch have to be true for this branch to be true. If 'OR' is used, only one of the filters in this branch has to be true for this branch to be true.
*** *Property*: Property to compare against.
*** *Comparison*: How to compare the value for this property against the provided value. Depending on the type of property selected, various comparison values are available. See <<_advanced_query_builder_comparators,Types of Comparators>>
*** *Search Terms*: The value for the property to use during comparison.
*** *Sorting*: Sort results by relevance, distance, created time, modified time or effective time.
*** *Sources*: Perform an enterprise search (the local {ddf-catalog} and all federated sources) or search specific sources.
+
** [[_advanced_query_builder_comparators]]*Advanced Query Builder Comparators*
[no-bullet]
*** *Textual*:
[no-bullet]
**** *CONTAINS*: Equivalent to <<_text_search_details,Basic Text Search>> with Matchcase set to No.
**** *MATCHCASE*: Equivalent to <<_text_search_details,Basic Text Search>> with Matchcase set to Yes.
**** *`=`*: Matches if an attribute is precisely equal to that search term.
**** *NEAR*: Performs a fuzzy proximity-based textual search. A NEAR query of `"car street" within 3` matches a sample text of `the blue car drove down the street with the red building` because performing three word deletions in that phrase (`drove`, `down`, `the`) causes `car` and `street` to become adjacent.
**** *EMPTY*: Search records when the attribute itself does not exist or when the attribute value is null.
+
More generally, a NEAR query of `"A B" within N` matches a text document if you can perform at most N insertions/deletions to your document and end up with `A` followed by `B`.
+
It is worth noting that `"street car" within 3` does not match the above sample text because it is not possible to match the phrase `"street car"` after only three insertions/deletions. `"street car" within 5` does match, though, as you can perform three word deletions to get `"car street"`, one deletion of one of the two words, and one insertion on the other side.
+
If multiple terms are used in the phrase, then the `within` amount specifies the total number of edits that can be made to attempt to make the full phrase match. `"car down street" within 2` matches the above text because it takes two word deletions (`drove`, `the`) to turn the phrase `car drove down the street` into `car down street`.
+
*** *Temporal*:
[no-bullet]
**** *BEFORE*: Search records before a specified time.
**** *AFTER*: Search records after a specified time.
**** *RELATIVE* Search records relative to the current time.
**** *EMPTY*: Search records when the attribute itself does not exist or when the attribute value is null.
+
*** *Spatial*:
[no-bullet]
**** *INTERSECTS*: Gives a component with the same functionality as <<_spatial_search_details,Basic Spatial Search>>.
**** *EMPTY*: Search records when the attribute itself does not exist or when the attribute value is null.
+
*** *Numeric*:
[no-bullet]
**** *`>`*: Search records with field entries greater than the specified value.
**** *`>=`*: Search records with field entries greater than or equal to the specified value.
**** *`=`*: Search records with field entries equal to the specified value.
**** *`\<=`*: Search records with field entries less than or equal to the specified value.
**** *RANGE*: Search records between the two specified values (inclusive).
**** *`<`*: Search records with field entries less than the specified value.
**** *EMPTY*: Search records when the attribute itself does not exist or when the attribute value is null.
