1. Home
  2. Knowledge Base
  3. PRO Features
  4. PRO Galleries
  5. How to add Frontend Image Search to galleries

How to add Frontend Image Search to galleries

Do you have galleries with a ton of images? Our Frontend Image Search display is a great way to add a search bar to any of your galleries so users can quickly find the images they’re looking for.

FrontEnd Image Search with Masonry, twenty twenty

This feature is a display type, so first, all you need to add the search bar on your galleries is to select the Frontend Image Search as the display when adding your gallery to a page.

Front End Image Search, global settings:

You will find the general settings for Frontend Image Search under NextGEN Gallery > Gallery Settings > Frontend Image Search:

  • Display results as: Search results will be displayed using the chosen display type.
  • Enable filtering results by tag: If enabled, it will fetch all of the tags assigned to the images found throughout the search. Note: We use a method that restricts the search results to only images with those tags (and multiple tags can be selected).
  • Search image alttext: option to include image alttext (title) in the fulltext search.
  • Search image description: option to include image descriptions in the fulltext search.
  • Search image tags: whether to include image tags in the search – one of these three “search image ___” fields must be selected and the admin will automatically enable “search image tags” should the admin user try to disable all three.
  • Database search mode: See the “database search mode” segment below.
  • Limit search results: You can limit the results in our search display, a setting of zero means no limit.
  • Order by relevance first: When this is selected, it will place the most relevant search results at the front of the list (based on alttext and description). If more than one image has the same relevance score then the following “Order search results by” setting are used to decide the order. If disabled this relevance is discarded and only the second “Order search results by” field will be used.
  • Order search results by: This particular setting will have different options that you can choose to order your results.
  • Order direction of search results: Ascending or Descending.

Filtering results by tag

Users can even filter the results based on the tags that get added to the images.

In this screenshot, the search phrase is wedding but if we select Couple, it will only display those images tagged with both Couple and wedding.

Couple search result

Database search mode

We provide our users with two options: a “natural language search” and a “boolean search”.

This search interprets the search string as a phrase in free-flowing text. There are no special operators except quotation marks. To give an example of how this works, we have set up a test gallery of a bunch of French paintings. Several of the images have the words “Venus” and “adonis” in their descriptions, so searching for “adonis venus” will return all of those images in the results. Including quotation marks and searching for “Venus and adonis” will cause mySQL to only return images that have the exact phrase “Venus and adonis” together in that order. The database server will apply limited amounts of altering the search phrase to find results; e.g. a search for “your server” may also include (albeit with a lower relevance score) images whose title/description includes the words “my server”.

Stopwords do apply – These are words so common that MySQL fulltext searches basically ignore them. Searching for “adonis and venus” is the same as searching for “adonis venus” or “adonis became venus” or “venus changes different everything everywhere hardly adonis”. However, applying the quotation operator will overcome the stopwords list. A search for “Venus changes Adonis” will only produce results if an image title/description has the exact words “Venus changes Adonis” in that order. If more than 50% of the images being searched include the same word or phrase in their title/description, MySQL will treat those as stopwords: for example, if a gallery has the word “painting” used in every image title/description then a search for “painting” will produce no results because the term is so common it loses relevance.

Boolean searches use their own special query language and stopwords are omitted from the search; so a search for “currently” will return no results even if there are images with the word “currently” in their title/description. The 50% threshold forced on natural language searches does not apply.

Also, please be aware that the Boolean Search does not function on tags. It only works on titles and descriptions.

Boolean search special operators

Not using an operator Implies OR
+ Stands for “AND”
Stands for “NOT”
> Changes the relevance of the following term to a higher level
< Changes the relevance of the following term to a lower level
~ Changes the relevance of the following term to no level
* Wildcard — applied only after a search term
Like natural language search, this forces results that match in the exact order presented inside quotes
() It creates a sub-expression that can be nested.

Examples

apple banana Will find images with the words apple or banana.
+apple +banana Will find images that have both words
+apple banana Will find images that have apple and will rank those with ‘banana’ higher in relevance.
+apple -banana Will find images that have apple but not banana.
+apple ~banana Will find images that have apple but if the image also has banana it will be scored as less relevant than those without the word banana
+apple +(>pie < tart) Will find images that have “apple pie” or “apple tart” but will give higher relevance to “apple pie”
apple* Will find images with ‘apple’, ‘apples’, ‘applesauce’, ‘applet’, or any word that just begins with ‘apple’.
“apple and banana” Will find images that have the exact phrase “apple and banana”

Related Articles

Close Menu