A detailed description of Lucene query parser syntax can be found at http://lucene.apache.org/core/old_versioned_docs/versions/2_9_0/queryparsersyntax.html.
Based on the level of allowed syntax specified by the Search options property of Smart search dialog with results or Smart search results web parts, users can enter search queries with restrictions as described below:
•Basic - all Lucene search query syntax (as described on the page linked above) are recognized except for field searching.
•None - no query syntax is recognized. All text entered by users is processed as a part of the searched for expression.
•Full - all search query syntax is processed, including field searching.
Search syntax errors
If special search expressions are allowed by the Search options property, a parsing error occurs if a user enters the query syntax incorrectly.
By default, the standard "no results" message is shown to the user in this case, and the error is entered into the application's Event log. If you wish to have syntax errors displayed in place of the results directly on the live site, you can enable the Show parsing errors property of the given smart search results web part.
Field searching may be used to define additional conditions in search expressions. All conditions must start with either the + or - symbol. The + symbol indicates that only results which fulfill the field condition should be returned. The - symbol has the opposite meaning, only results that do not contain the specified value in the given field will be retrieved.
•+network +NewsReleaseDate:[20080101 TO 20091231]
When searching for this expression using a document index, only news documents containing the word network, released in the year 2008 or 2009 will be returned.
Keep in mind that only fields set as Searchable in the field configuration of the given object type may be included in field searches. If there is no field name specified before a value in the expression (such as the word network in the example above), the system will search the index fields marked as Content. Information about the search field configuration of objects can be found in the Settings for particular object types topic.
Additionally, field searches will only be processed correctly if the search dialog web part has its Search mode set to Any words.
Unless the web part used to display the search results has its Block field-only search property enabled, it is also possible to perform direct field searches without any standard content keywords. This allows users to find records simply by entering an exact field value:
•DocumentNodeID:(int)17 - returns the document with a nodeID equal to 17.
•NewsTitle:"New features" - returns the news document titled New features.
•SKUDepartmentID:(int)4 - returns all products that belong to the department that has 4 as its ID.
Using field search queries provides a great deal of flexibility, but it is not very convenient for regular website visitors. If you wish to allow users to limit the scope of searches through conditions on the live site, it is recommended to prepare appropriate Smart search filters.
When performing field searches, the values specified are understood as strings by default. If you know that you are searching in integer or double fields, you will need to specify the type of the field the following way:
•DocumentNodeID:[(int)1 TO (int)100]
Due to the same reason, search in DateTime fields also requires special syntax in format <field name>:yyyymmddhhmm. So for example:
•DocumentCreatedWhen:[200902020101 TO 200906020101]
If you need to specify date and time using a macro, you will need to use the (tosearchdatetime) parameter to convert the returned value to a format suitable for Lucene.
You can also use the (add) parameter, which adds the specified amount of minutes to the value.
Indexes created by Stop and Simple analyzers cannot be searched using the standard field search format. This is by design, but you can use a workaround with a range query containing identical boundaries:
•newsid:[(int)22 TO (int)22]