SearchBlox allows you to perform faceted, API-based and security-enabled search.
[Faceted Search](šļ»æ)
[Search API](šļ»æ)
[Secure Search](šļ»æ)
SearchBlox supports an industry standard search query syntax with operators, and faceted search.
## **Search Query Syntax**
SearchBlox query syntax is a combination of Elasticsearch query syntax and custom query syntax.
## **Operators in Search**
Operator Description | Operator | Example |
Wildcard Operator | * (Asterisk Operator) ? (Question Operator) | `test\* `
`te?t_ ` |
Fuzzy Search Operator | ~ (Tilde Operator) | `roam~ ` |
Proximity | ~10 (Tilde with numeric operators) | `āsearchblox j2eeā~10 ` |
Exact Search Operator | "" (Double Quotes operator) | `āOld is gold" ` |
OR Operator | OR | `āsearchblox serverā OR elasticsearch ` |
AND Operator | AND | `searchblox AND j2ee ` |
NOT Operator | NOT | `āsearchblox serverā NOT j2ee ` |
Plus Operator | + (Plus Operator) | `+searchblox j2ee ` |
Prohibit Operator | - (Minus Operator) | `"searchblox serverā -j2ee ` |
Fielded Search Operator | : (Colon Operator) | `keywords:news ` |
Escape Operator | \ | `test\~ ` |
## **Fielded Search**
Field | Description | Example |
title | Title of the document | `title: test ` |
keywords | Keywords from the document | `keywords: search ` |
description | Description of the document | `description: "This is test" ` |
url | URL of the document | `url: "https://www.searcblox.com" ` |
content | content of the document | `content: searchblox content ` |
contenttype | File type of the document | `contenttype: pdf ` |
meta data | custom fields index from html, files or databases | `author: Stephan ` |
Grouping | combination of SearchBlox and custom fields can be provided in fielded search | `title: test AND author: Stephen AND keywords:search `
`+travel +world +(title:news) `
`((world AND travel) OR keywords:news) AND cnn ` |
### Wildcard Search
SearchBlox supports single and multiple wildcard character search.
To perform a single character wildcard search, use the `
?
` symbol. To perform a multiple character wildcard search, use the `*
` symbol.The single character wildcard search looks for terms that match with the single character replaced.
To search for `
text
` or `test
` you can use the search query: `te?t_
`Multiple character wildcard searches look for 0 or more characters.
To search for `
test
`, `tests
`, or `tester
`, you can use the search query: `test\*
`You can also use a wildcard character in the middle of a term. `
te\*t
`
### Fuzzy Search
SearchBlox supports fuzzy search. Fuzzy search can also be referred to as an approximate search and can fetch results even for incorrect spelling.
To perform a fuzzy search, use the tilde `
~
` symbol at the end of a single word term in the search query.To search for a term similar in spelling to `
roam
`, use the fuzzy search query: `roam~
` This search will find terms like `foam
` and `roams
`.If you want a fuzzy search for more than one term, fuzzy search operator has to be used separately for each term,
To perform a fuzzy search on `
International earth day
`, use the search query: `international~ earth~ day
`
### Proximity Search
SearchBlox supports proximity search which allows you to find words within a specific distance.
To do a proximity search, use the tilde `
~
` symbol at the end of a phrase.To search for āsearchbloxā and āj2eeā within 10 words of each other in a document use the search query: `
āsearchblox j2eeā~10
`
### Exact Search or Phrase Search
To find documents with the exact phrase, the search query has to be enclosed within double quotes.
To search the phrase `
Old is gold
`, use the search query: `āOld is gold"
`
### Boolean Operators
Boolean operators allow search query terms to be combined through logic operators.
SearchBlox supports `
AND
`, `+
`, `OR
`, `NOT
` and `-
` as Boolean operatorsBoolean operators `
AND
`, `OR
` and `NOT
` must be ALL CAPS.For the Boolean search to work, enable Case Sensitive search to `
yes
` in Search Settings.

_Case Sensitivity in Search Settings_
**OR Operator**
The `
OR
` operator is the default operator in SearchBlox Search API.The OR operator finds documents if either of the terms or phrases exists in a document.
To search for documents that contain either the phrase `
searchblox server
` or just the term `elasticsearch
` use the below search query: `āsearchblox serverā OR elasticsearch
`The following search query finds documents with either terms: `
searchblox j2ee
`
**AND Operator**
The `
AND
` operator finds documents where both terms exist anywhere in the text of the document.To find documents that contain `
searchblox
` and `j2ee
` use the following query: `searchblox AND j2ee
`
**NOT Operator**
The `
NOT
` operator excludes documents that contain the term after NOT.To search for documents that contain āsearchblox serverā but not āj2eeā, use the search query: `
āsearchblox serverā NOT j2ee
`The `
NOT
` operator cannot be used with just one term.The following search will return no results: `
NOT āsearchblox serverā
`
**Plus Operator "+"**
The `
+
` or required operator requires the term after the `+
` symbol to exist somewhere in the field of a single document.To search for documents that must contain `
searchblox
` and may contain `j2ee
` use the search query: `+searchblox j2ee
`
**Minus Operator "-"**
The `
-
`, or minus operator, excludes documents that contain the term after the `-
` symbol.To search for documents that contain `
āsearchblox serverā
` but not `j2ee
` use the search query: `"searchblox serverā -j2ee
`
### Fielded Search
SearchBlox supports fielded search where you can search within a specific field.
The default search is performed on content, title, description, and other custom fields that have been mapped to the content.
This search can be made specific using fielded search.
Fielded search requires you to give the field name followed by a colon `
:
`, and then the search term you are looking for.Examples: `
keywords:news
` `title:world
` `url:"http://www.bbc.com"
`When performing fielded search on url field, the url has to be enclosed in double-quotes.
You can perform fielded search on standard fields as well as custom fields.
The following fields that can be used for fielded search queries:
Fields | Default | Description | Example |
content | Yes | Document content | content:test |
keywords | Yes | Document keywords | keywords:news |
title | Yes | Document title | title:"world news" |
description | Yes | Document description | description:world |
url | No | Document URL | url:"http://edition.cnn.com" |
contenttype | No | Document format | contenttype:pdf contenttype:word |
language | No | ar ā Arabic bn ā Bengali zhcn - Chinese cs ā Czech da ā Danish nl ā Dutch en ā English es ā Estonian fi ā Finnish fr ā French de ā German el ā Greek gu ā Gujarati iw ā Hebrew hi ā Hindi hu ā Hungarian it ā Italian ja ā Japanese kn ā Kannada ko ā Korean lv ā Latvian lt ā Lithuanian mal ā Malayalam no ā Norwegian pl ā Polish pt ā Portuguese ro ā Romanian ru ā Russian sk ā Slovak sl ā Slovenian es ā Spanish sv ā Swedish ta ā Tamil te ā Telugu th ā Thai tr ā Turkish | language:en |
### Grouping
SearchBlox supports using parentheses to group clauses to form sub-queries.
Grouping is useful for users who want to control the Boolean logic for a query.
To search for either `
searchblox
` or `server
`, and `j2ee
`, use the query: `(searchblox OR server) AND j2ee
`You can also group fielded search with Boolean operators to form complex queries like: `
+travel +world +(title:"news")
` `(world AND travel) OR keywords:news
` `((world AND travel) OR keywords:news) AND cnn
`
### Default AND/OR operation
In Search API when more than one search term is used, the default operator used is `
OR
`.We support a special parameter `
&default=AND
` which can change this query to `AND
`.In faceted search we use `
&default=AND
` as a standard to make `AND
` search with multiple terms.To learn more on this parameter read: [Search Parameters](šļ»æ)
## **Using Special Characters in Search**
SearchBlox uses the sb_analyzer by default. [sb_analyzer](šļ»æ) ignores the special characters; however, the special characters would appear in context. We strip off the special characters while indexing. If you want to retain the special characters for search, you can change the analyzer.
The following characters can be used directly without escape character:
@#$^&-+=|",.?,(),*Ā
eg: test@
The following characters require escape character preceding it:
~,{ },!,:, < >,_,[] ,/ \ ,%
eg: test\%
FuzzyĀ search operator i.e., tilde ~ operator cannot be used directly or using an escape character. The search term with characte~r can be enclosed in double-quotes for search.
eg: "test~nest"
To learn about search analyzers and how to handle special characters visit: [Analyzers in SearchBlox] (doc:elasticsearch-custom-analyzers)
## **Sample Search Queries**
Search Query | Search Results |
`searchblox test ` | If default=OR,
contain the words `searchblox ` or `test `.
If default=AND,
contain the words `searchblox ` or `test `. |
`enterprise (contenttype:word OR contenttype:excel OR contenttype:msg) ` | contain the word `enterprise ` and have the file types as Word, Excel, or .msg. |
`"Enterprise Search" ` | contain the exact expression `Enterprise Search `. |
`Enterprise AND Search ` | contain the words `Enterprise ` and `Search `. |
`("Enterprise" OR "Search") AND "SearchBlox" ` | contain the word `Enterprise ` or `Search ` and the word `SearchBlox `. |
`SearchBlox NOT test ` | contain the word `SearchBlox ` but **not** the word `test `. |
`(Wellness^2.0 OR help) AND learning ` | contain `Wellness ` or `help ` and `learning `. The occurrence of `Wellness ` is twice as strong rated as other terms. |
`+Enterprise +Search ` | contain the words `Enterprise ` and `Search `. |
`Enterprise Search +SearchBlox ` | contain the word `Enterprise ` or `Search ` and the word `SearchBlox `. |
`+(Enterprise Search) +SearchBlox ` | contain either `Enterprise ` or `Search ` and `SearchBlox ` |
`SearchBlox -test ` | contain the word `SearchBlox ` but **not **the word `test `. |