Lens sort menu1 media/lens-sort_thumb.png 2021-05-12T13:25:02-07:00 Erik Loyer f862727c4b34febd6a0341bffd27f168a35aa637 3296 1 A screen shot of the Lens editor’s sort menu. plain 2021-05-12T13:25:02-07:00 Erik Loyer f862727c4b34febd6a0341bffd27f168a35aa637
This page is referenced by:
Learn how to edit a Lens.
Whether it appears on the Manage Lenses screen or on a lens’ standalone page, the lens editor functions in the same way. The editor displays the lens’ title at the top left, its various expression components at the bottom left, the number of results it returns in the top right, and an options menu in the bottom right.
A new lens contains a single visualization menu and a single content selection menu. Making selections from those menus will open various modal windows as needed to configure the component. Next to those menus is a “plus” button which allows additional content selections, filters, and sorts to be added. Every time a change is made to the lens, its results are retrieved and displayed (the current result count is displayed in the top right corner).
If you have editing privileges for the lens, a number of options are available.
Changing the lens title
You can directly edit the title of the lens in the editor.
Editing the lens expression
The expression is the set of rules that determine what content will be returned by the lens. It’s represented by a set of colored drop-down menus, each of which identifies a separate component of the expression.
A lens is a dynamic visualization, so every lens expression begins by indicating which Scalar visualization will be used to render the results returned by the lens.
Content selections (blue)
A visualization needs something to visualize, and so the next component of every lens expression is a selection of content from the current Scalar project. This is might be a set of specific, hand-picked items, a set of items with the same type, or a set of items geo-tagged within a certain distance of a particular location. The three types of content selections are as follows:
Specific items...Enables you to select any combination of individual content items to include in the lens.
Items by type...Allows you to select entire groups of items (annotations, pages, etc.) from the book.
Items by distance...Enables you to select items from the book that are geo-located within a specific distance (in miles or kilometers) from a given latitude/longitude pair. Note that latitude and longitude must be entered in decimal format, with negative latitudes representing the southern hemisphere, and negative longitudes representing the western hemisphere.
Working with multiple content selections
To construct more complex queries, you can add more than one content selection to a lens using the plus button. As soon as a second content selection is added, a gray drop-down menu appears at the top of the editor allowing you to configure whether the lens should return either the combined set of all content selections (combination), or just the results that all of the selections have in common (intersection).
Each content selection can be modified with one or more optional filters. Content can be filtered by type, by text content, Scalar relationship, distance from a geotagged item, quantity, metadata content, and date last visited. Note that the relationship filter is the only one which can actually expand the content selection, by adding related items (for example, all of the items tagged or annotated by the original selection).
When configuring a filter, the number on the left side of the modal window shows the number of items selected prior to application of the filter, and the number on the right side shows the number of items returned after the filter is applied.
Filter by type...
This filter only allows content through that matches (or doesn't match) one or more Scalar content types.
Filter by content...
This filter only allows pages through that contain (or don't contain) the specified text in its body content.
Filter by relationship...
This filter adds content that is related to the content already selected. The type and direction of the relationship can be specified.
Filter by distance...
This filter adds content that is geotagged within a specified distance from any of the content items already selected.
Filter by quantity...
This filter limits the number of items returned to a specific amount (especially useful when combined with sorts, see below).
Filter by metadata...
This filter only allows pages through that contain (or don't contain) the specified text in a particular metadata field. See Lenses and metadata for more info on targeting specific fields.
Filter by visit date...
This filter only allows pages through that have been visited within the specific time range.
Sorts appear after all content selections — they determine the order of the complete set of content returned by the lens. Content can be sorted alphabetically by title, by creation or modification date, by distance from a location, by Scalar type, number of relationships, number of text matches, or by visit date.
Sorts the content alphabetically by the contents of a specific metadata field. See Lenses and Metadata for more info on targeting specific fields.
Sorts the content by its creation date.
Date last modified
Sorts the content by its modification date.
Sorts the content by its distance (in miles or kilometers) from a given latitude/longitude pair. Note that latitude and longitude must be entered in decimal format, with negative latitudes representing the southern hemisphere, and negative longitudes representing the western hemisphere.
Sorts the content by type.
Sorts the content by the number of relationships it has to other content.
String match count
Sorts the content by the number of times it matches a specific text string in a particular metadata field. See Lenses and Metadata for more info on targeting specific fields.
Sorts the content by the date the current user last visited it.