Frontend Image Search
As of March 2020, NextGEN Gallery now includes front end search functionality for your existing galleries. This new feature is considered a display type, so you must use our Insert Graphic Window to include a search bar inside a page or post - just as you would add any other NextGEN Gallery display.
Here is a video explaining how to use our Front end Image search gallery display
Check the online demo here: https://www.imagely.com/wordpress-gallery-plugin/frontend-image-search/
Front End Image Search, global settings:
You will find the general settings under Gallery > Gallery Settings > Frontend Image Search. Here are the available settings:
- 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 that 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
In this screenshot, the search phrase is "wedding".
If we select only "Couple", it will only display those images tagged with both "Couple". Note: You are free to use the button "Clear Selected tags" to remove any tag filter.
Database search mode
We provide our users with two options: a "natural language search" and a "boolean search".
Natural language 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 description, 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.|
|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"|
Remember that this is a new feature and we do appreciate any feedback. Feel free to report any bugs using this form: https://www.imagely.com/report-bug/