Search syntax

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

Detailed description of Lucene query parser syntax can be found at http://lucene.apache.org/java/2_1_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 in formats described below:

 

None - in this mode, none of the query formats described at the page linked above will be recognized. All text entered by the users will be understood as the phrase they are looking for.

 

Basic - in this mode, all query formats described at the linked page will be recognized except of fields search.

 

Full - in this mode, all search options including fields search will be recognized.

 

 

Searching numeric fields

 

When performing fields search, the values specified are understood as string 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:

 

newsid:(int)22
skuprice:(double)255.0
nodeid:[(int)1 TO (int)100]

 

 

Searching date and time fields

 

Due to the same reason, search in DateTime fields also requires special syntax in format <field name>:yyyymmddhhmm. So for example:

 

created:200812230101
created:[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 the format  suitable for Lucene.

 

{%CurrentDateTime|(tosearchdatetime)%}

 

You can also use the |(add) parameter, which adds the specified amount of seconds to the value.

 

{%CurrentDateTime|(add)-10080|(tosearchdatetime)%}

 

 

Field search with Stop and Simple analyzers

 

Indexes created by Stop and Simple analyzers can not be searched using the standard field search format. This is by design, but you can use a workaround with a range query containing identical range boundaries:

 

newsid:[(int)22 TO (int)22]

 

Page url: http://devnet.kentico.com/docs/devguide/index.html?smart_search_search_syntax.htm