The plugin ‚NGG Smart Image Search‘ enables the user to search for images by using various searchstrings. In its simplest form it will search for the complete text (= original searchstring) entered into the searchbox of a widget in the sidebar or into the searchbox of a shortcode on a searchpage. By default the resultlist will be ordered by descending image ids, i.e. the last uploaded images first.
Before being passed to a database query the searchstring is sanitized for security reasons, i.e. special characters are being taken care of. Depending on the settings of the webmaster, the searchstring will be searched for in the title of an image, in the description of an image, in the filename or in the tags assigned to an image. An image will show up in the search result list, if the searchstring is contained in any of the image fields title, description, filename or in any of its tags and if the image is not excluded from display by NextGEN gallery and if the hosting gallery is not excluded from the search by webmaster settings.
The webmaster has the option to configure a search differently for public users or for logged in users.
The standard search action is to search for the complete searchstring.
Example: searchstring „sun“ will search for all images having this textstring „sun“ contained in either title, description, filename or tags. It will find terms like ‚morning sun‘, ’sunset‘, ’sunday‘, ’sunglasses‘ etc.. The searchstring may also have leading or trailing blanks. So the searchstring „ sun “ will only find the term ‚morning sun ‚, but not terms like ’sunset‘, ’sunday‘ etc..
Currently there are in addition to the complete searchstring also some special search codes available:
This will search for the <nn> most recent images.
Here the term ‚recent images‘ is used as by NextGEN gallery, i.e. it looks for the images with the most recent imagedates (imagedates as given by the image exif data).
Example: r:15 will search for the 15 most recent images.
This will search for the <nn> last uploaded images.
When uploading, NextGEN gallery will use automatically incremented picture ids = pid.
Example: l:15 will search for the 15 last uploaded images independent of their imagedate.
This will search for all images in gallery <nn>.
By default this search option is only available for logged in users.
Also by default, it will even list excluded images. As mentioned above, the gallery is only listed if this gallery is not being excluded by webmasters settings.
Example: g:3 will list all images of gallery 3.
Standard searches only search for the complete searchstring. In contrast to this will advanced searches search for a free combination of searchstrings.
Example: „sun & city & street“ will search for images which have all of these three terms in any of their fields title, description, filename or tags. Here the operator“ & “ stands for a logical AND and must have a trailing and a leading blank to be correctly recognized.
You can use any combination of searchstrings including special codes.
Example: „r:30 & tree & big“ will search for all images with reference to the strings ‚tree‘ and ‚big‘ and will list the 30 most recent found images.
Advanced searches can also use the exclusion operator“ -& „.
Example: „city & long street -& car“ will list all images with reference to ‚city‘ and ‚long street‘ which do not refer to the string ‚car‘.
Not all formally possible advanced searches are meaningful if combined with special search codes:
Example: „r:30 & l:30 & tree“ does not make sense, because you cannot sort the search list by date (r:30) and by upload order (l:30).
Finally, the search operators ‚&‘ and ‚-&‘ can also be used at the beginning of the searchstring. However, ‚&‘ at the beginning will have no effect, as it does not change anything (the following search term will be searched anyway).
Example: „-& red sunset“ will search for all images not refering to ‚red sunset‘. In this case the search operator must not have a leading blank.
Whereas the symbols “ & “ and “ -& “ refer for their search to all search fields title, description, filename and tags, the following symbols
„ &a “ and „ -&a “ only refer to the field title (=alternate)
“ &d “ and “ -&d “ only refer to the field description
“ &f “ and “ -&f “ only refer to the field filename
“ &t “ and “ -&t “ only refer to tags of an image
Complex searches can use any order of combining symbols. By also including empty searchstrings or only blanks the complex searches can become quite tricky.
The symbols can also be used at the beginning of a searchstring, in that case only without a leading blank.
Example: „r:10 &t sunset -&t sea“ will search for images with tag ’sunset‘, which do not have a tag ’sea‘ at the same time. The result list will return the 10 most recent images.
Example „g:5 & r:3“ will return the three most recent images in gallery 5.
In principle you can also search for an empty searchstring. However, an empty searchstring is contained in any searchfield, so this does not make much sense. There is only one exception coded when an empty searchstring is restricted to tags:
Operator ‚&t‘ will search for images having ANY tags and ‚-&t‘ will search for images having NO TAGS at all.
Example „g:5 &t “ will search for all images in gallery 5, which have some tags.
Example „g:5 -&t “ will search for all images in gallery 5, which do not have any tags at all.
Dynamic display types for search results
As documented on the page display search result list the layout of the search result list is determined by the display parameter of the shortcode hr_SIS_display_images. This display type is statically defined for the shortcode.
However, the user can dynamically override this static display type by using the desired display type as a suffix for the searchstring marked by a leading „>“ symbol.
Example: „sunset & city & clouds>at“ will show the search result list with an advanced thumbnails layout. The suffix must directly follow the searchstring without gap.