Searching

SearchBlox supports faceted search, API-based search, and secure search.

Searchblox uses a standard search query format that includes operators and faceted options.

Search Query Syntax

  • The SearchBlox query syntax combines Elasticsearch syntax with SearchBlox’s custom syntax.

Operators in Search

Operator DescriptionOperatorExample
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 OperatorOR“searchblox server” OR elasticsearch
AND OperatorANDsearchblox AND j2ee
NOT OperatorNOT“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

FieldDescriptionExample
titleTitle of the documenttitle: test
keywordsKeywords from the documentkeywords: search
descriptionDescription of the documentdescription: "This is test"
urlURL of the documenturl: "https://www.searcblox.com"
contentcontent of the documentcontent: searchblox content
contenttypeFile type of the documentcontenttype: pdf
meta datacustom fields index from html, files or databasesauthor: Stephan
Groupingcombination of SearchBlox and custom fields can be provided in fielded searchtitle: test AND author: Stephen AND keywords:search

+travel +world +(title:news)

((world AND travel) OR keywords:news) AND cnn

Wildcard Search

  • SearchBlox lets you use wildcard searches with single or multiple characters.
  • Use ? for a single-character wildcard and * for multiple characters.
  • The ? wildcard matches only one character.
  • Example: To match text or test, use te?t.
  • The * wildcard matches zero or more characters.
  • Example: To match test, tests, or tester, use test*.
  • You can also place wildcards in the middle of a word, like te*t.

Fuzzy Search

  • SearchBlox supports fuzzy search, which finds results even when words are misspelled.
  • To use it, add a ~ at the end of a single word.
  • Example: Searching roam~ will also match words like foam and roams.
  • For multiple words, add the fuzzy operator to each word separately.
  • Example: international~ earth~ day~ performs a fuzzy search on all three words.

Proximity Search

  • SearchBlox supports proximity search, which finds words that appear near each other.
  • To use proximity search, put a ~ at the end of a phrase and specify the distance between words.
  • Example: To find “searchblox” and “j2ee” within 10 words of each other, use:
    "searchblox j2ee"~10

Exact Search or Phrase Search

  • To find documents with an exact phrase, enclose the phrase in double quotes.
  • Example: To search for Old is gold, use: "Old is gold"

Boolean Operators

  • Boolean operators** combine search terms using logic.
  • SearchBlox supports: AND, +, OR, NOT, and -.
  • Operators AND, OR, and NOT must be in ALL CAPS.

OR Operator

  • The OR operator is the default in the SearchBlox Search API.
  • It finds documents if either of the terms or phrases exists.
  • Example: To search for documents containing either "searchblox server" or elasticsearch, use: "searchblox server" OR elasticsearch.
  • A simple query like searchblox j2ee also returns documents containing either term.

AND Operator

  • The AND operator finds documents where both terms appear in the text.
  • Example: To search for documents containing searchblox and j2ee, use: searchblox AND j2ee.

NOT Operator

  • The NOT operator excludes documents that contain the term following NOT.
  • Example: To find documents containing "searchblox server" but not j2ee, use: "searchblox server" NOT j2ee.
  • The NOT operator cannot be used alone; a query like NOT "searchblox server" will return no results.

Plus Operator "+"

  • The + (required) operator ensures that the term after + must exist in a document.
  • Example: To search for documents that must include searchblox and may include j2ee, use: +searchblox j2ee.

Minus Operator "-"

  • The - (minus) operator excludes documents containing the term after -.
  • Example: To find documents containing "searchblox server" but not j2ee, use: "searchblox server" -j2ee.
    *Fielded Search**
  • SearchBlox supports fielded search, allowing searches within a specific field.
  • By default, searches are performed on content, title, description, and other mapped custom fields.
  • To search a specific field, use the syntax: fieldname:searchterm.
  • Examples:
    keywords:news
    title:world
    url:"http://www.bbc.com"
  • For url field, enclose the URL in double-quotes.
  • Fielded search works on standard fields and custom fields.
  • The following fields can be used in fielded search queries:
FieldsDefaultDescriptionExample
contentYesDocument contentcontent:test
keywordsYesDocument keywordskeywords:news
titleYesDocument titletitle:"world news"
descriptionYesDocument descriptiondescription:world
urlNoDocument URLurl:"http://edition.cnn.com"
contenttypeNoDocument formatcontenttype:pdf
contenttype:word
languageNoar – 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 and create sub-queries.
  • Grouping allows you to control Boolean logic in a query.
  • Example: To search for either searchblox or server, and also j2ee:
    (searchblox OR server) AND j2ee
  • Fielded search can also be grouped with Boolean operators for complex queries:
    +travel +world +(title:"news")
    (world AND travel) OR keywords:news
    ((world AND travel) OR keywords:news) AND cnn

Default AND/OR operation

  • In the SearchBlox API, when multiple search terms are used, the default operator is OR.
  • You can change the default to AND by using the parameter &default=AND.
  • In faceted search, &default=AND ensures that multiple terms are combined with the AND operator.
  • To learn more on this parameter read: Search Parameters

Using Special Characters in Search

  • SearchBlox uses sb_analyzer by default, which ignores special characters during indexing, though they can appear in context.
  • To retain special characters for search, you can change the analyzer.
  • Characters that can be used directly without an escape character: @ # $ ^ & - + = | " , . ? ( ) *
  • Example: test@
  • Characters that require an escape character: ~ { } ! : < > _ [ ] / \ %
  • Example: test%
  • The fuzzy search operator ~ cannot be used directly or with an escape character; enclose the term in double quotes for search.
  • Example: "test~nest"
  • For more on search analyzers and handling special characters, refer: Analyzers in SearchBlox

Sample Search Queries

Search QuerySearch Results
searchblox testIf default=OR, contain the words searchblox or test. If default=AND, contain both words.
enterprise (contenttype:word OR contenttype:excel OR contenttype:msg)Contain the word enterprise and have file types Word, Excel, or .msg.
"Enterprise Search"Contain the exact phrase Enterprise Search.
Enterprise AND SearchContain both words Enterprise and Search.
("Enterprise" OR "Search") AND "SearchBlox"Contain the word Enterprise or Search and also SearchBlox.
SearchBlox NOT testContain the word SearchBlox but not the word test.
(Wellness^2.0 OR help) AND learningContain Wellness or help and learning. Wellness is weighted twice as strong as other terms..
+Enterprise +SearchMust contain both words Enterprise and Search.
Enterprise Search +SearchBloxContain Enterprise or Search and must contain SearchBlox.
+(Enterprise Search) +SearchBloxContain either Enterprise or Search and must contain SearchBlox.`
SearchBlox -testContain SearchBlox but not the word test.