Searching The Lens can be done simply by using the search bar or the Structured Search page. After your initial search you can refine your parameters using the various faceted filters available to you. However for users who want to go above and beyond with their specificity it is also possible to use native search syntax to create sophisticated searches. Our documentation for this syntax is still a work in progress, but the core information you need to use it can be found below.
Apache Lucene & ElasticSearch – Query Parser Syntax
The Lens uses a modified form of the Apache Lucene and Elasticsearch Query Parser Syntax. For more details on the query syntax used, we highly recommend you read these comprehensive guides on the query syntax’s used here:
Some important notes about the syntax:
- To search for a value in an indexed field you type the name of the field followed by a colon and then the value you wish to search. For example:
- When you want to search on multiple fields you can use boolean operators which all must be upper case. For example:
rice AND pesticide
malaria OR mosquito
printing NOT inkjet
- Lucene and Elasticsearch supports
AND
,OR
,NOT
,+
(must include) and-
(must not include) as boolean operators.- The default Boolean operator in a Lens search is
AND
e.g.blue green
is equivalent toblue AND green
- For more information on how boolean logic works, see this tutorial.
- The default Boolean operator in a Lens search is
- Other operators available include:
- Term grouping: Lucene and Elasticsearch supports using parentheses
( )
to group terms into sub-queries e.g.(red AND yellow) OR (blue and green)
- Field grouping: Lucene supports using parentheses to group multiple clauses to a single field e.g.
title:(car OR truck)
*
and?
for wildcard searches. Note that wildcard search terms are not stemmed and therefore may not work as expected for searches where “Stemming” (located in “Query Tools“) is turned on. This is because when stemming is turned on, search terms are matched against stemmed values in the index. For example the termsvalve
andvalves
will be stemmed tovalv
and both match the stemmed value valv in the index. The termvalve*
will not be stemmed and therefore won’t matchvalv
in the index. Read more about stemming on wikipedia.~
for fuzzy/proximity searches."foo bar"~4
searches forfoo
andbar
within 4 words from each other. Exact matches are proximity zero and word transpositions(bar foo)
are proximity 2.TO
for range searches, e.g.date_published:[2020-01-01 TO 2022-12-12]
^
to boost the relevance of a value in a search, affects the result order eg.car AND coke^2
\
to escape the following special query syntax characters in a search term that are not inside quotes:(+ - && || ! ( ) { } [ ] ^ ~ * ? : \ /)
- Term grouping: Lucene and Elasticsearch supports using parentheses
Example Queries
The following are a series of example queries to give you some examples of how the syntax works:
transgenic rice
lens_id:022-382-024-804-703
inventor:"Jefferson Richard"~2
"method and system for direct recording of video information onto a disk medium"
doc_number:20150315267
"US 2015\/0315267 A1"
+claim:"种循环煤泥水的高效澄清方法"
– search in Chinese query language(abstract:β-glucuronidase) OR (title:β-glucuronidase)
applicant.name:"Australian National University"
application_reference.date:[2007-01-01 TO 2007-03-31] AND date_published:[2007-01-01 TO 2007-06-31]
owner_all.name:"Asgrow seed company" OR applicant.name:"Asgrow seed company"
class_national.symbol:(221\/220)
– the forward slashes (/
) in queries must be escaped by a backslash (\
) if the query term is not inside quotesclass_national.symbol:"221/220"
query term is inside quotes so the forward slash (/
) does not need to be escaped by a backslash
Index Fields
A list of searchable indexed fields is available from the Structured Search page.
