Search version 2 (beta)¶
Search version 2 is based on the same principles as search version 1. The SearchDocument has no intervals, joins, groups, metadataGroups, and filter elements as in ItemSearchDocument. Information on how functionality is made accessible in search version 2 can be found in Difference between both searches.
Applicable exceptions and new usage concepts are explained on Search version 2 and Migration to search version 2.
Note
To use the new search implementation we recommend to review and revise your metadata structure and clearly separate
metadata in generic and timed data:
generic: Data that applies to the whole entity (item or collection), i.e. the generic-INF..+INFtimespan, and only is set once per entity, for example:created,owner,accessGroups,admin. This corresponds tointervals=genericin search version 1.timed: Data that is used in non-generic timespans and may set on multiple timespans. When searching for timed data, the criteria are defined in thetimespanselement of the SearchDocument. This corresponds tointervals=timedin search version 1.- If a search is performed with timed and generic data, the search operation corresponds a search with the element
intervals=allin the search version 1.
New in version 25.4: VidiCore now supports multilingual search. It is enabled by setting useMultipleSearchIndices to true.
When enabled, multiple language-specific indices can be created which analyze fields of type string for the index’ language.
On search operations the new query parameter searchLang specifies which language index should be used for search operations.
The searchLang query parameter must equal one one the lang attribute values in MetadataValueType for VidiCore to determinate the correct index.
Please refer to Multilingual search migration before activating this feature. Indices for all languages need to be created before performing a search on one of them. See Search2 index creation (beta) for index creation.
Important
When setting useMultipleSearchIndices to true be sure to run POST /APIinit/indices or POST /APIinit to synchronize existing default indices of VidiCore for this feature.
When initializing or recreating the default indices of VidiCore and the useMultipleSearchIndices is already set to true, the call POST /APIinit/indices or POST /APIinit is necessary as well.
SearchDocument explained¶
The following documentation explains the SearchDocument and all search options available. Please note that this only applies to search version 2.
text: With thetextpart VidiCore performs an overall search and returns all entities which contains thetextvalue anywhere in their metadata documents. If thetextvalue located is in an timed event, the result document contains specific timestamps and fields. When specifying multipletextvalues, an implicitORis added. For example, if you search fortext1andtext2, the result will contain all entities which contain eithertext1ortext2in their metadata documents.
field: With thefieldpart you search only for generic fields in the index. If a field is embedded in one or multiple group(s) please specify the group path to this field with this pattern:Group/field,Group/subgroup/field. Otherwise you simply search for the field. For examples for a field search with timespans please see Field elements.
operator: The operator allows combining multiple search criteria. Each operator contains a singleoperation. Supported operations areAND,OR, andNOT. WithANDall criteria must be met. WithORat least one of the criteria must be met. WithNOTthe criteria must not be met. An operator may contain a list offieldelements to which the operator is applied. See Operator for examples.
timespans: The outertimespanselement may contain one or multiple innertimespansand a singleoperation.
timespans: Eachtimespanscontains multiple fields, an operator and a name. The purpose of atimespansobject is to search in one index field within all timespans of an entity. By using multipletimespansyou can search multiple index fields within different timespans within an entity.
name: A unique specification for thetimespanselement for identification; this is essential for highlightíng. If multiple timespans are used in the search, it is necessary to specify a name for eachtimespans`. Otherwise the search will result in an exception and fail.fields: Add all fields as explained. For examples for a field search with timespans please see Field elements.operator: For more complex searches, one operator contains oneoperationand multiplefields. Additionally each operator contains multiple inner operators. Please be aware that an operator intimespansis not the same operator as in the ItemSearchDocument and contains only the previously called elements. See Operator for examples.
operation: The operation of the outertimespanselement is applied to all innertimespanselements. Supported operations areAND,OR, andNOT.
sort: Sorts all matching entities s by the given criteria.
field: Field name as explained previously.order:ascendingordescendingnested: Specifies if the field is nested (timed data, fields in shapes or fields in files connected to shapes). This is a boolean value which default isfalse.
highlight:
prefix: the html start tag, e.g. for xml requests:<em>or for json requests:<em>suffix: the html end tag, e.g. for xml requests:</em>or for json requests:</em>field: A list of field names only for generic data.timespansField: A list of field names only for timed data.matchingOnly: Specifies whether to highlight only fields that contain a search query match.
suggestion:
maximumSuggestions: Integer of how many suggestion should be returned.accuracy: Double value of how accurate the suggestions should be.
autocomplete: Each autocomplete request must contain only one field name, a prefix of the word, and the boolean statement if the request is nested. Search 2 autocompletion requires a prefix.
field: Field name as explained previously.text: The beginning of the wanted word.nested: See sort explanation.maximumSuggestions: The maximum of returned suggestions.
cursor: Thecursorelement is a marker to return entities after the given cursor. If the value of the cursor is*, the search returns entities from the beginning and returns a new cursor, which points to the end of the given entities. Use the received cursor to continue the search where you stopped.
facet: Thefacetelement is used to get a count of matching items and collections. The result can contain a count or a range of the results. Search version 2 can search within timed data as well. For more details look at Faceting.
Text elements¶
With the text element of the SearchDocument you can perform an overall search with on or multiple values. The text element only
performs a search on values of metadata of type string or string-exact.
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<text>text-example-value</text>
<text>text-example-value2</text>
</SearchDocument>
Field elements¶
If a field is embedded in one or multiple group(s), it has to be searched as one field as
following pattern: Group/field, Group/subgroup/field. Otherwise you simply search for the field name.
Note
For a search with groups, please note following information: Groups.
A search can be performed for only generic, only timed or for both kind of metadata. To combine both generic and timed metadata, the search input has to be sorted in the correct search elements.
Generic field search¶
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<field>
<name>V3_Officials/V3_Official/V3_Official_Type</name>
<value>Referee</value>
</field>
</SearchDocument>
This field only exists once in one metadata document with timestamps start="-INF" and end="+INF" and will be searched
in the field element.
Timed field search¶
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<timespans operation="AND">
<timespans name="FirstName">
<fields>
<name>V3_Event_Football/V3_PrimaryParticipant/V3_FirstName</name>
<value>Jarrad</value>
</fields>
</timespans>
</timespans>
</SearchDocument>
This field exists multiple times in an entity with timestamps not containing “-INF” or “+INF”, and has to be searched in the timespans element.
Combined field search¶
The combined search works for all elements of the SearchDocument. For the following example you search for a game which has a referee and an event where a player called “Bob” is playing.
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<timespans operation="AND">
<timespans name="example_timespans">
<fields>
<name>V3_Event_Football/V3_PrimaryParticipant/V3_FirstName</name>
<value>Bob</value>
</fields>
</timespans>
</timespans>
<field>
<name>V3_Officials/V3_Official/V3_Official_Type</name>
<value>Referee</value>
</field>
</SearchDocument>
As in the other search, if you search with a field with multiple values, an implicit OR is added.
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<field>
<name>V3_HomeTeam</name>
<value>California</value>
<value>Southampton</value>
</field>
</SearchDocument>
is logically equivalent to
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<field>
<name>V3_HomeTeam</name>
<value>California<value>
</field>
<field>
<name>V3_HomeTeam</name>
<value>Southampton</value>
</field>
</SearchDocument>
Note
Please be aware that a range search, on fields of type string or string-exact, is performed as an string comparison by OpenSearch.
Results of this kind of search may be unreliable, but still possible. Range searches with fields of type date, float,
integer and long, are performed reliably by OpenSearch.
Operator¶
The main operator and the operator in the timespans element are handled similarly. The main operator in the SearchDocument is expected once, while the timespans element contains a list of operator.
Timespans operator¶
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<timespans operation="AND">
<timespans name="operator-example">
<operator operation="AND">
<field>
<name>V3_Event_Football/V3_PrimaryParticipant/V3_FirstName</name>
<value>Bob</value>
</field>
</operator>
<operator operation="AND">
<field>
<name>V3_Event_Football/V3_PrimaryParticipant/V3_Position</name>
<value>Midfielder</value>
</field>
</operator>
</timespans>
</timespans>
</SearchDocument>
Generic operator¶
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<operator operation="AND">
<operator operation="OR">
<operator operation="NOT">
<field>
<name>V3_HomeTeam/V3_Player/V3_FirstName</name>
<value>Luke</value>
</field>
<field>
<name>V3_HomeTeam/V3_Player/V3_Position</name>
<value>Forward</value>
</field>
</operator>
<operator operation="NOT">
<field>
<name>V3_HomeTeam/V3_Player/V3_FirstName</name>
<value>Samuel</value>
</field>
<field>
<name>V3_HomeTeam/V3_Player/V3_Position</name>
<value>Forward</value>
</field>
</operator>
</operator>
</operator>
</operator>
</SearchDocument>
Note
When searching for field values inside field groups you can search for different fields that are defined within the same group like shown in the above examples.
If items (or collections) have multiple instances of this field group, VidiCore will return all items matching the requested field within any instance of the group. However, it is not guaranteed that the match is within the same field group instance.
Example:
Item VX-1:
Group
V3_Event_Football/V3_PrimaryParticipantinstance 1:V3_FirstName="Luke"V3_Position="Forward"
Group
V3_Event_Football/V3_PrimaryParticipantInstance 2:V3_FirstName="Samuel"V3_Position="Midfielder"
Item VX-2:
Group
V3_Event_Football/V3_PrimaryParticipantinstance 1:V3_FirstName="Luke"V3_Position="Midfielder"
Group
V3_Event_Football/V3_PrimaryParticipantinstance 2:V3_FirstName="James"V3_Position="Forward"
When searching for items with V3_Event_Football/V3_PrimaryParticipant/V3_FirstName="Luke"
and V3_Event_Football/V3_PrimaryParticipant/V3_Position="Midfielder", VidiCore will return item VX-2
because instance 1 of the group is matching. VidiCore will also return item VX-1 because
V3_Event_Football/V3_PrimaryParticipant/V3_FirstName="Luke" is present in group instance 1 and
V3_Event_Football/V3_PrimaryParticipant="Midfielder" is present in Person group instance 2.
It is not possible to restrict search to having a match of both fields within the same group instance.
Highlighting¶
For highlighting you need to specify the prefix, the suffix, the wanted fields and if matching fields in timespans should be highlighted with specific timestamps. If you add a specific text value, the highlighting will return which of the given fields contains the value.
New in version 25.2.7.
To highlight, fields have to be sorted in either field for generic data or in timespansField for timed data. A combined highlight with generic and timed fields is possible.
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<text>text-example-value</text>
<highlight>
<prefix><em></prefix>
<suffix></em></suffix>
<timespansField>V3_Event_Football/V3_Event_Location_Pitch</field>
<field>V3_Season</field>
</highlight>
</SearchDocument>
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<timespans operation="AND">
<timespans name="Location_Pitch">
<fields>
<name>V3_Event_Football/V3_Event_Location_Pitch</name>
<value>PASS</value>
</fields>
</timespans>
</timespans>
<highlight>
<prefix><em></prefix>
<suffix></em></suffix>
<timespansField>V3_Event_Football/V3_Event_Location_Pitch</field>
</highlight>
</SearchDocument>
Sorting¶
If the nested element is true, then the given field is defined as timed data, in shapes or in files connected to shapes. If it is set to false, then the given field is generic in items or collections. The default value for sorting is the field created.
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<sort>
<field>created</field>
<order>ascending</order>
<nested>false</nested>
</sort>
</SearchDocument>
Autocomplete¶
If the nested element is true, then the given field is defined as timed data, in shapes or in files connected to shapes. If it is set to false, then the given field is generic in items or collections. The text element must be given in the autocomplete request. Without the text element, the request will fail. If the autocomplete request is send without field, the response will contain matching values which begin with the text element.
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<autocomplete>
<text>S</text>
<field>V3_HomeTeam</field>
<nested>true</nested>
<maximumSuggestions>10</maximumSuggestions>
</autocomplete>
</SearchDocument>
Faceting¶
For faceting set the nested element to true if the count has to be performed for timespans fields, fields in shapes or fields in files connected to shapes.
If set to false, the count will be performed on generic fields of items and collections.
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<facet count="true" nested="false" name="V3_Event_Football/V3_PrimaryParticipant/V3_FirstName">
<field>V3_Event_Football/V3_PrimaryParticipant/V3_FirstName</field>
<exclude>V3_Event_Football/V3_PrimaryParticipant/V3_FirstName</exclude>
</facet>
<facet count="true" nested="false" name="V3_CollectionType">
<field>V3_CollectionType</field>
<exclude>V3_CollectionType</exclude>
</facet>
</SearchDocument>
For more details and examples regarding the facet element see search version 1 - faceting.
New in version 25.2.4.
To use the exclude element from the SearchFacetType for search version 2, it is necessary to specify the filterName
of the SearchFieldType. All exclude entries must match at least one filterName, otherwise the field won’t
be excluded and added as a filter criteria for the facet count.
Wildcard search¶
New in version 25.2.6.
Search version 2 supports wildcard search for a phrase (e.g. foo b* is able to find foo bar) on a specific field.
New in version 25.4.12.
Search version 2 supports wildcards for overall search on the text element.
When performing a wildcard search on a field of type string, search version 2 performs this search on the original string,
meaning if the field contains following value: "This is a example",
the search is performed on this exact string and not the analysed tokens. The wildcard search in search version 2 is case insensitive.
Here are a few examples for the string "This is a example":
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<field>
<name>Example_Field</name>
<value>Th*</value>
</field>
</SearchDocument>
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<field>
<name>Example_Field</name>
<value>This*exam*</value>
</field>
</SearchDocument>
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<field>
<name>Example_Field</name>
<value>*exam*</value>
</field>
</SearchDocument>
<SearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<text>exam*</text>
</SearchDocument>