The SearchableItemAttributeSet module defines metadata properties for SearchItem and UserActivity objects.
Requires: iOS 9.0 and later
The SearchableItemAttributeSet object provides a large number of properties covering most common scenarios such as files, music, video, and document searches. To effectively add and remove information from the iOS search index you will need to use the below listed modules:
Ti.App.iOS.SearchableItem
Ti.App.iOS.SearchableIndex
Ti.App.iOS.SearchableItem
objects to the device search indexTo use this feature make sure you have a compatible device running iOS 9 or later.
To create a SearchableItemAttributeSet object, use the Titanium.App.iOS.createSearchableItemAttributeSet method. Pass a dictionary of metadata properties to the method to associate with a SearchableItem object or UserActivity. At minimum, you must set the itemContentType property.
Pass the SearchableItemAttributeSet object to either the Titanium.App.iOS.createSearchableItem method to the attributeSet
key
or to a UserActivity object's addContentAttributeSet() method.
The following example demonstrates how to create a new Ti.App.iOS.SearchableItem and add a Ti.App.iOS.SearchableItemAttributeSet. The Ti.App.iOS.SearchableItem is then passed to the Ti.App.iOS.SearchableIndex object to add it to the on-device search index.
var searchItems = [];
var itemAttr = Ti.App.iOS.createSearchableItemAttributeSet({
itemContentType: Ti.App.iOS.UTTYPE_IMAGE,
title:"Titanium Core Spotlight Tutorial"
});
itemAttr.contentDescription ="Tech Example \nOn: " + String.formatDate(new Date(),"short");
itemAttr.keywords =["Mobile","Appcelerator","Titanium"];
var item = Ti.App.iOS.createSearchableItem({
uniqueIdentifier:"my-id",
domainIdentifier:"com.mydomain",
attributeSet:itemAttr
});
searchItems.push(item);
var indexer = Ti.App.iOS.createSearchableIndex();
indexer.addToDefaultSearchableIndex(searchItems,function(e){
if(e.success){
alert("Press the home button and now search for your keywords");
}else{
alert("Errored: " + JSON.stringify(e.error));
}
});
The date that the item was moved into the current location.
Requires: iOS 9.0 and later
The date will be a string in the following format: "yyyy-MM-dd'T'HH:mm:ss.SSS'+0000'"
For example, 2015-12-25T23:30:55.978+0000
The title for a collection of media.
Requires: iOS 9.0 and later
An array of localized strings of alternate display names for this item.
Requires: iOS 9.0 and later
The name of the API that this proxy corresponds to.
The name of the API that this proxy corresponds to.
The value of this property is the fully qualified name of the API. For example, Button
returns Ti.UI.Button
.
A class of entity for whom the resource is intended or useful.
Requires: iOS 9.0 and later
A class of entity may be determined by the creator, publisher or third party.
The number of channels in the audio data contained in the file.
Requires: iOS 9.0 and later
This item only represents the number of discreet channels of audio data found in the file. It does not indicate any configuration of the data in regards to a user's speaker setup.
The name of the application that encoded the data contained in the audio file.
Requires: iOS 9.0 and later
The sample rate of the audio data contained in the file.
Requires: iOS 9.0 and later
The sample rate is a float value representing Hertz (audio_frames/second), for example, 44100.0 or 22254.54.
The track number of a song/composition when it is part of an album.
Requires: iOS 9.0 and later
Indicates if the proxy will bubble an event to its parent.
Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.
Default: true
The codecs used to encode/decode the media.
Requires: iOS 9.0 and later
Comment related to a file.
Requires: iOS 9.0 and later
The composer of the song/composition contained in the audio file.
Requires: iOS 9.0 and later
A list of contacts that are somehow associated with this document beyond what is captured as Author.
Requires: iOS 9.0 and later
Display of the search container
Requires: iOS 9.0 and later
Display of the search container
Requires: iOS 9.0 and later
Identifier for the search container
Requires: iOS 9.0 and later
Identifier for the search container
Requires: iOS 9.0 and later
Order the search container is displayed.
Requires: iOS 9.0 and later
Title displayed in the search container
Requires: iOS 9.0 and later
Title displayed in the search container
Requires: iOS 9.0 and later
The date that the contents of the item were created.
Requires: iOS 9.0 and later
The date will be a string in the following format: "yyyy-MM-dd'T'HH:mm:ss.SSS'+0000'"
For example, 2015-12-25T23:30:55.978+0000
An account of the content of the resource.
Requires: iOS 9.0 and later
Description may include but is not limited to: an abstract, table of contents, reference to a graphical representation of content or a free-text account of the content.
The date that the contents of the item were last modified.
Requires: iOS 9.0 and later
The date will be a string in the following format: "yyyy-MM-dd'T'HH:mm:ss.SSS'+0000'"
For example, 2015-12-25T23:30:55.978+0000
Whether or not the item has explicit content. Set to 1
for explicit or 0
for clean.
Requires: iOS 9.0 and later
Used to indicate where the item was obtained from.
Requires: iOS 9.0 and later
UTI Type pedigree for an item.
Requires: iOS 9.0 and later
Array of strings related to the content tree of the item.
Requires: iOS 9.0 and later
File URL representing the content to be indexed.
Requires: iOS 9.0 and later
Used to designate the entity responsible for making contributions to the content of the resource.
Requires: iOS 9.0 and later
Copyright of the content.
Requires: iOS 9.0 and later
Used to designate the extent or scope of the content of the resource.
Requires: iOS 9.0 and later
Application used to create the document content (e.g. "Word","Framemaker", etc.).
Requires: iOS 9.0 and later
The delivery type of the item. Set to 0
for fast start and 1
for RTSP.
Requires: iOS 9.0 and later
Director of the item, for example, the movie director.
Requires: iOS 9.0 and later
A localized string to be displayed in the UI for this item.
Requires: iOS 9.0 and later
The date that the file was last downloaded / received.
Requires: iOS 9.0 and later
The date will be a string in the following format: "yyyy-MM-dd'T'HH:mm:ss.SSS'+0000'"
For example, 2015-12-25T23:30:55.978+0000
Duration in seconds of the content of the item (if appropriate).
Requires: iOS 9.0 and later
The list of editor/editors that have worked on this item.
Requires: iOS 9.0 and later
Software used to convert the original content into a PDF stream.
Requires: iOS 9.0 and later
Size of the document in MB.
Requires: iOS 9.0 and later
Array of font names used in the item.
Requires: iOS 9.0 and later
The fully formatted address of the item (obtained from MapKit).
Requires: iOS 10.0 and later
Used to indicates whether the MIDI sequence contained in the file is setup for use with a General MIDI device.
Requires: iOS 9.0 and later
Should be 1
if true and 0
otherwise.
Genre of the item, for example, movie genre.
Requires: iOS 9.0 and later
Used to reference to the resource within a given context.
Requires: iOS 9.0 and later
Recommended best practice is to identify the resource by means of a string or number conforming to a formal identification system.
Information about the item.
Requires: iOS 9.0 and later
Content type of the attribute set.
Requires: iOS 9.0 and later
Must be set to create a SearchableItemAttributeSet object. Set to an identifier in the iOS Developer Library: System-Declared Uniform Type Identifiers
This API can be assigned the following constants:
The musical key of the song/composition contained in an audio file.
Requires: iOS 9.0 and later
Represents keywords associated with this particular item. Example keywords might be Birthday etc.
Requires: iOS 9.0 and later
Kind that the item represents.
Requires: iOS 9.0 and later
Used to designate the languages of the intellectual content of the resource.
Requires: iOS 9.0 and later
The date that the item was last used.
Requires: iOS 9.0 and later
The date will be a string in the following format: "yyyy-MM-dd'T'HH:mm:ss.SSS'+0000'"
For example, 2015-12-25T23:30:55.978+0000
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.
Whether or not the item is local. Set to 1
if true and 0
otherwise.
Requires: iOS 9.0 and later
The lyricist/text writer for song/composition contained in the audio file.
Requires: iOS 9.0 and later
Media types present in the content.
Requires: iOS 9.0 and later
The date that the last metadata attribute was changed.
Requires: iOS 9.0 and later
The date will be a string in the following format: "yyyy-MM-dd'T'HH:mm:ss.SSS'+0000'"
For example, 2015-12-25T23:30:55.978+0000
The musical genre of the song/composition contained in the audio file.
Requires: iOS 9.0 and later
Metadata attribute that stores the category of instrument.
Requires: iOS 9.0 and later
Files should have an instrument associated with them ("Other Instrument" is provided as a catch-all). For some categories, like "Keyboards" there are instrument names which provide a more detailed instrument definition, for example, Piano, Organ, etc.
Metadata attribute that stores the name of instrument.
Requires: iOS 9.0 and later
Relative to the instrument category. Files can have an instrument name associated with them if they have certain instrument categories, for example, the category Percussion has multiple instruments, including Conga and Bongo.
Used to indicate company/Organization that created the document.
Requires: iOS 9.0 and later
Original format of the movie.
Requires: iOS 9.0 and later
Original source of the movie.
Requires: iOS 9.0 and later
Number of pages in the item.
Requires: iOS 9.0 and later
Height in points (72 points per inch) of the document page.
Requires: iOS 9.0 and later
First page only for PDF's - other pages within the PDF may not be the same height.
Width in points (72 points per inch) of the document page.
Requires: iOS 9.0 and later
First page only for PDF's - other pages within the PDF may not be the same width.
The list of people who are visible in an image or movie or written about in a document.
Requires: iOS 9.0 and later
The complete path to the item.
Requires: iOS 9.0 and later
Performers in the movie.
Requires: iOS 9.0 and later
User play count of this item.
Requires: iOS 9.0 and later
The postal code for the item according to guidelines established by the provider.
Requires: iOS 10.0 and later
The list of projects that this item is part of.
Requires: iOS 9.0 and later
Used to designate the entity responsible for making the resource available.
Requires: iOS 9.0 and later
User rating of this item out of 5 stars.
Requires: iOS 9.0 and later
A description of the rating, for example, the number of reviewers.
Requires: iOS 9.0 and later
The recording date of the song/composition.
Requires: iOS 9.0 and later
This information differs from
the contentCreationDate
attribute as it indicates the date that the
'art' was created, in contrast to contentCreationDate which for example, could indicate
the creation date of an edited or 'mastered' version of the original art.
The date will be a string in the following format: "yyyy-MM-dd'T'HH:mm:ss.SSS'+0000'"
For example, 2015-12-25T23:30:55.978+0000
Used to provide a link to information about rights held in and over resource.
Requires: iOS 9.0 and later
Used to indicate the role of the document creator.
Requires: iOS 9.0 and later
Security (encryption) method used in the file.
Requires: iOS 9.0 and later
Whether the content is prepared for streaming. Set to 0
for not streamable and 1
for streamable.
Requires: iOS 9.0 and later
The sub-location (e.g., street number) for the item according to guidelines established by the provider.
Requires: iOS 10.0 and later
Used to indicate that using the phone number is appropriate.
Requires: iOS 9.0 and later
If supportsPhoneCall
is 1
and the item has the phoneNumbers
property set, then the phone number
may be used to initiate phone calls. This should be used to indicate that using the phone
number is appropriate, and a primary action for the user. For example, supportsPhoneCall
would be set on a business, but not an academic paper that happens to have phone numbers
for the authors or the institution.
The tempo of the music contained in the audio file in Beats Per Minute.
Requires: iOS 9.0 and later
The location (e.g., street name) for the item according to guidelines established by the provider.
Requires: iOS 10.0 and later
Image data for thumbnail for this item.
Requires: iOS 9.0 and later
File URL pointing to a thumbnail image for this item.
Requires: iOS 9.0 and later
The time signature of the musical composition contained in the audio/MIDI file.
Requires: iOS 9.0 and later
The title of the particular item.
Requires: iOS 9.0 and later
The total bit rate (audio and video combined) of the media.
Requires: iOS 9.0 and later
A version specifier for this item.
Requires: iOS 9.0 and later
Adds the specified callback as an event listener for the named event.
Name of the event.
Callback function to invoke when the event is fired.
Applies the properties to the proxy.
Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.
A dictionary of properties to apply.
Fires a synthesized event to any registered listeners.
Name of the event.
A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.
Removes the specified callback as an event listener for the named event.
Multiple listeners can be registered for the same event, so the
callback
parameter is used to determine which listener to remove.
When adding a listener, you must save a reference to the callback function in order to remove the listener later:
var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);
To remove the listener, pass in a reference to the callback function:
window.removeEventListener('click', listener);
Name of the event.
Callback function to remove. Must be the same function passed to addEventListener
.
Sets the value of the addedDate property.
New value for the property.
Sets the value of the album property.
New value for the property.
Sets the value of the alternateNames property.
New value for the property.
Sets the value of the artist property.
New value for the property.
Sets the value of the audiences property.
New value for the property.
Sets the value of the audioBitRate property.
New value for the property.
Sets the value of the audioChannelCount property.
New value for the property.
Sets the value of the audioEncodingApplication property.
New value for the property.
Sets the value of the audioSampleRate property.
New value for the property.
Sets the value of the audioTrackNumber property.
New value for the property.
Sets the value of the bubbleParent property.
New value for the property.
Sets the value of the codecs property.
New value for the property.
Sets the value of the comment property.
New value for the property.
Sets the value of the composer property.
New value for the property.
Sets the value of the contactKeywords property.
New value for the property.
Sets the value of the containerDisplayName property.
New value for the property.
Sets the value of the containerIdentifier property.
New value for the property.
Sets the value of the containerOrder property.
New value for the property.
Sets the value of the containerTitle property.
New value for the property.
Sets the value of the contentCreationDate property.
New value for the property.
Sets the value of the contentDescription property.
New value for the property.
Sets the value of the contentModificationDate property.
New value for the property.
Sets the value of the contentRating property.
New value for the property.
Sets the value of the contentSources property.
New value for the property.
Sets the value of the contentType property.
New value for the property.
Sets the value of the contentTypeTree property.
New value for the property.
Sets the value of the contentURL property.
New value for the property.
Sets the value of the contributors property.
New value for the property.
Sets the value of the copyright property.
New value for the property.
Sets the value of the coverage property.
New value for the property.
Sets the value of the creator property.
New value for the property.
Sets the value of the deliveryType property.
New value for the property.
Sets the value of the director property.
New value for the property.
Sets the value of the displayName property.
New value for the property.
Sets the value of the downloadedDate property.
New value for the property.
Sets the value of the duration property.
New value for the property.
Sets the value of the editors property.
New value for the property.
Sets the value of the encodingApplications property.
New value for the property.
Sets the value of the fileSize property.
New value for the property.
Sets the value of the fontNames property.
New value for the property.
Sets the value of the fullyFormattedAddress property.
New value for the property.
Sets the value of the generalMIDISequence property.
New value for the property.
Sets the value of the genre property.
New value for the property.
Sets the value of the identifier property.
New value for the property.
Sets the value of the information property.
New value for the property.
Sets the value of the keySignature property.
New value for the property.
Sets the value of the keywords property.
New value for the property.
Sets the value of the languages property.
New value for the property.
Sets the value of the lastUsedDate property.
New value for the property.
Sets the value of the lifecycleContainer property.
New value for the property.
Sets the value of the local property.
New value for the property.
Sets the value of the lyricist property.
New value for the property.
Sets the value of the mediaTypes property.
New value for the property.
Sets the value of the metadataModificationDate property.
New value for the property.
Sets the value of the musicalGenre property.
New value for the property.
Sets the value of the musicalInstrumentCategory property.
New value for the property.
Sets the value of the musicalInstrumentName property.
New value for the property.
Sets the value of the organizations property.
New value for the property.
Sets the value of the originalFormat property.
New value for the property.
Sets the value of the originalSource property.
New value for the property.
Sets the value of the pageCount property.
New value for the property.
Sets the value of the pageHeight property.
New value for the property.
Sets the value of the pageWidth property.
New value for the property.
Sets the value of the participants property.
New value for the property.
Sets the value of the performers property.
New value for the property.
Sets the value of the playCount property.
New value for the property.
Sets the value of the postalCode property.
New value for the property.
Sets the value of the producer property.
New value for the property.
Sets the value of the projects property.
New value for the property.
Sets the value of the publishers property.
New value for the property.
Sets the value of the rating property.
New value for the property.
Sets the value of the ratingDescription property.
New value for the property.
Sets the value of the recordingDate property.
New value for the property.
Sets the value of the relatedUniqueIdentifier property.
New value for the property.
Sets the value of the rights property.
New value for the property.
Sets the value of the securityMethod property.
New value for the property.
Sets the value of the streamable property.
New value for the property.
Sets the value of the subThoroughfare property.
New value for the property.
Sets the value of the subject property.
New value for the property.
Sets the value of the supportsPhoneCall property.
New value for the property.
Sets the value of the tempo property.
New value for the property.
Sets the value of the theme property.
New value for the property.
Sets the value of the thoroughfare property.
New value for the property.
Sets the value of the thumbnailData property.
New value for the property.
Sets the value of the thumbnailURL property.
New value for the property.
Sets the value of the timeSignature property.
New value for the property.
Sets the value of the title property.
New value for the property.
Sets the value of the totalBitRate property.
New value for the property.
Sets the value of the version property.
New value for the property.
Sets the value of the videoBitRate property.
New value for the property.