# Titanium.App.iOS.SearchableItemAttributeSet

The SearchableItemAttributeSet module defines metadata properties for SearchItem and UserActivity objects.

Availability
5.0.0
9.2.0

# Overview

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:

To 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 Titanium.App.iOS.SearchableItemAttributeSet.itemContentType property.

Pass the SearchableItemAttributeSet object to either the Titanium.App.iOS.createSearchableItem method to the attributeSet key or to a UserActivity object's Titanium.App.iOS.UserActivity.addContentAttributeSet method.

# Examples

# Add Searchable Content to the On-Device Index

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.

# app.js

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));
    }
});

# Properties

# addedDate

Availability
5.0.0
9.2.0
addedDate :String

The date that the item was moved into the current location.

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


# album

Availability
5.0.0
9.2.0
album :String

The title for a collection of media.


# alternateNames

Availability
5.0.0
9.2.0
alternateNames :Array<String>

An array of localized strings of alternate display names for this item.


# apiName READONLY

Availability
5.0.0
9.2.0
apiName :String

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, Titanium.UI.Button returns Ti.UI.Button.


# artist

Availability
5.0.0
9.2.0
artist :String

The artist for the media.


# audiences

Availability
5.0.0
9.2.0
audiences :Array<String>

A class of entity for whom the resource is intended or useful.

A class of entity may be determined by the creator, publisher or third party.


# audioBitRate

Availability
5.0.0
9.2.0
audioBitRate :Number

The audio bit rate.


# audioChannelCount

Availability
5.0.0
9.2.0
audioChannelCount :Number

The number of channels in the audio data contained in the file.

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.


# audioEncodingApplication

Availability
5.0.0
9.2.0
audioEncodingApplication :String

The name of the application that encoded the data contained in the audio file.


# audioSampleRate

Availability
5.0.0
9.2.0
audioSampleRate :Number

The sample rate of the audio data contained in the file.

The sample rate is a float value representing Hertz (audio_frames/second), for example, 44100.0 or 22254.54.


# audioTrackNumber

Availability
5.0.0
9.2.0
audioTrackNumber :Number

The track number of a song/composition when it is part of an album.


# bubbleParent

Availability
5.0.0
9.2.0
bubbleParent :Boolean

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


# codecs

Availability
5.0.0
9.2.0
codecs :Array<String>

The codecs used to encode/decode the media.


# comment

Availability
5.0.0
9.2.0
comment :String

Comment related to a file.


# composer

Availability
5.0.0
9.2.0
composer :String

The composer of the song/composition contained in the audio file.


# contactKeywords

Availability
5.0.0
9.2.0
contactKeywords :Array<String>

A list of contacts that are somehow associated with this document beyond what is captured as Author.


# containerDisplayName

Availability
5.0.0
9.2.0
containerDisplayName :String

Display of the search container


# containerIdentifier

Availability
5.0.0
9.2.0
containerIdentifier :String

Identifier for the search container


# containerOrder

Availability
5.0.0
9.2.0
containerOrder :Number

Order the search container is displayed.


# containerTitle

Availability
5.0.0
9.2.0
containerTitle :String

Title displayed in the search container


# contentCreationDate

Availability
5.0.0
9.2.0
contentCreationDate :String

The date that the contents of the item were created.

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


# contentDescription

Availability
5.0.0
9.2.0
contentDescription :String

An account of the content of the resource.

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.


# contentModificationDate

Availability
5.0.0
9.2.0
contentModificationDate :String

The date that the contents of the item were last modified.

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


# contentRating

Availability
5.0.0
9.2.0
contentRating :Number

Whether or not the item has explicit content. Set to 1 for explicit or 0 for clean.


# contentSources

Availability
5.0.0
9.2.0
contentSources :Array<String>

Used to indicate where the item was obtained from.


# contentType CREATION ONLY

Availability
5.0.0
9.2.0
contentType :String

UTI Type pedigree for an item.


# contentTypeTree

Availability
5.0.0
9.2.0
contentTypeTree :Array<String>

Array of strings related to the content tree of the item.


# contentURL

Availability
5.0.0
9.2.0
contentURL :String

File URL representing the content to be indexed.


# contributors

Availability
5.0.0
9.2.0
contributors :Array<String>

Used to designate the entity responsible for making contributions to the content of the resource.


copyright :String

Copyright of the content.


# coverage

Availability
5.0.0
9.2.0
coverage :Array<String>

Used to designate the extent or scope of the content of the resource.


# creator

Availability
5.0.0
9.2.0
creator :String

Application used to create the document content (e.g. "Word","Framemaker", etc.).


# deliveryType

Availability
5.0.0
9.2.0
deliveryType :Number

The delivery type of the item. Set to 0 for fast start and 1 for RTSP.


# director

Availability
5.0.0
9.2.0
director :String

Director of the item, for example, the movie director.


# displayName

Availability
5.0.0
9.2.0
displayName :String

A localized string to be displayed in the UI for this item.


# downloadedDate

Availability
5.0.0
9.2.0
downloadedDate :String

The date that the file was last downloaded / received.

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

Availability
5.0.0
9.2.0
duration :Number

Duration in seconds of the content of the item (if appropriate).


# editors

Availability
5.0.0
9.2.0
editors :Array<String>

The list of editor/editors that have worked on this item.


# encodingApplications

Availability
5.0.0
9.2.0
encodingApplications :Array<String>

Software used to convert the original content into a PDF stream.


# fileSize

Availability
5.0.0
9.2.0
fileSize :Number

Size of the document in MB.


# fontNames

Availability
5.0.0
9.2.0
fontNames :Array<String>

Array of font names used in the item.


# fullyFormattedAddress

Availability
6.0.0
9.2.0
fullyFormattedAddress :String

The fully formatted address of the item (obtained from MapKit).


# generalMIDISequence

Availability
5.0.0
9.2.0
generalMIDISequence :Number

Used to indicates whether the MIDI sequence contained in the file is setup for use with a General MIDI device.

Should be 1 if true and 0 otherwise.


# genre

Availability
5.0.0
9.2.0
genre :String

Genre of the item, for example, movie genre.


# identifier

Availability
5.0.0
9.2.0
identifier :String

Used to reference to the resource within a given context.

Recommended best practice is to identify the resource by means of a string or number conforming to a formal identification system.


# information

Availability
5.0.0
9.2.0
information :String

Information about the item.


# itemContentType CREATION ONLY

Availability
5.0.0
9.2.0
itemContentType :String

Content type of the attribute set.

Must be set to create a SearchableItemAttributeSet object. Set to an identifier in the iOS Developer Library: System-Declared Uniform Type Identifiers


# keySignature

Availability
5.0.0
9.2.0
keySignature :String

The musical key of the song/composition contained in an audio file.


# keywords

Availability
5.0.0
9.2.0
keywords :Array<String>

Represents keywords associated with this particular item. Example keywords might be Birthday etc.


# kind

Availability
5.0.0
9.2.0
kind :String

Kind that the item represents.


# languages

Availability
5.0.0
9.2.0
languages :Array<String>

Used to designate the languages of the intellectual content of the resource.


# lastUsedDate

Availability
5.0.0
9.2.0
lastUsedDate :String

The date that the item was last used.

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


# local

Availability
5.0.0
9.2.0
local :Number

Whether or not the item is local. Set to 1 if true and 0 otherwise.


# lyricist

Availability
5.0.0
9.2.0
lyricist :String

The lyricist/text writer for song/composition contained in the audio file.


# mediaTypes

Availability
5.0.0
9.2.0
mediaTypes :Array<String>

Media types present in the content.


# metadataModificationDate

Availability
5.0.0
9.2.0
metadataModificationDate :String

The date that the last metadata attribute was changed.

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


# musicalGenre

Availability
5.0.0
9.2.0
musicalGenre :String

The musical genre of the song/composition contained in the audio file.


# musicalInstrumentCategory

Availability
5.0.0
9.2.0
musicalInstrumentCategory :String

Metadata attribute that stores the category of instrument.

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.


# musicalInstrumentName

Availability
5.0.0
9.2.0
musicalInstrumentName :String

Metadata attribute that stores the name of instrument.

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.


# organizations

Availability
5.0.0
9.2.0
organizations :Array<String>

Used to indicate company/Organization that created the document.


# originalFormat

Availability
5.0.0
9.2.0
originalFormat :String

Original format of the movie.


# originalSource

Availability
5.0.0
9.2.0
originalSource :String

Original source of the movie.


# pageCount

Availability
5.0.0
9.2.0
pageCount :Number

Number of pages in the item.


# pageHeight

Availability
5.0.0
9.2.0
pageHeight :Number

Height in points (72 points per inch) of the document page.

First page only for PDF's - other pages within the PDF may not be the same height.


# pageWidth

Availability
5.0.0
9.2.0
pageWidth :Number

Width in points (72 points per inch) of the document page.

First page only for PDF's - other pages within the PDF may not be the same width.


# participants

Availability
5.0.0
9.2.0
participants :Array<String>

The list of people who are visible in an image or movie or written about in a document.


# path

Availability
5.0.0
9.2.0
path :String

The complete path to the item.


# performers

Availability
5.0.0
9.2.0
performers :Array<String>

Performers in the movie.


# playCount

Availability
5.0.0
9.2.0
playCount :Number

User play count of this item.


# postalCode

Availability
6.0.0
9.2.0
postalCode :String

The postal code for the item according to guidelines established by the provider.


# producer

Availability
5.0.0
9.2.0
producer :String

Producer of the content.


# projects

Availability
5.0.0
9.2.0
projects :Array<String>

The list of projects that this item is part of.


# publishers

Availability
5.0.0
9.2.0
publishers :Array<String>

Used to designate the entity responsible for making the resource available.


# rating

Availability
5.0.0
9.2.0
rating :Number

User rating of this item out of 5 stars.


# ratingDescription

Availability
5.0.0
9.2.0
ratingDescription :String

A description of the rating, for example, the number of reviewers.


# recordingDate

Availability
5.0.0
9.2.0
recordingDate :String

The recording date of the song/composition.

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


# relatedUniqueIdentifier

Availability
5.0.0
9.2.0
relatedUniqueIdentifier :String

For activities this is the unique identifier for the item this activity is related to.


# rights

Availability
5.0.0
9.2.0
rights :Array<String>

Used to provide a link to information about rights held in and over resource.


# role

Availability
5.0.0
9.2.0
role :String

Used to indicate the role of the document creator.


# securityMethod

Availability
5.0.0
9.2.0
securityMethod :String

Security (encryption) method used in the file.


# streamable

Availability
5.0.0
9.2.0
streamable :Number

Whether the content is prepared for streaming. Set to 0 for not streamable and 1 for streamable.


# subject

Availability
5.0.0
9.2.0
subject :String

Subject of the the item.


# subThoroughfare

Availability
6.0.0
9.2.0
subThoroughfare :String

The sub-location (e.g., street number) for the item according to guidelines established by the provider.


# supportsNavigation

Availability
5.0.0
9.2.0
supportsNavigation :Number

Used to determine if navigation is supported.

If supportsNavigation is set to 1, and the item has the latitude and longitude properties set, then the latitude and longitude may be used for navigation. For example, supportsNavigation would be set on a restaurant review, but not on a photo.


# supportsPhoneCall

Availability
5.0.0
9.2.0
supportsPhoneCall :Number

Used to indicate that using the phone number is appropriate.

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.


# tempo

Availability
5.0.0
9.2.0
tempo :Number

The tempo of the music contained in the audio file in Beats Per Minute.


# theme

Availability
5.0.0
9.2.0
theme :String

Theme of the the item.


# thoroughfare

Availability
6.0.0
9.2.0
thoroughfare :String

The location (e.g., street name) for the item according to guidelines established by the provider.


# thumbnailData

Availability
5.0.0
9.2.0
thumbnailData :String | Titanium.Blob

Image data for thumbnail for this item.


# thumbnailURL

Availability
5.0.0
9.2.0
thumbnailURL :String

File URL pointing to a thumbnail image for this item.


# timeSignature

Availability
5.0.0
9.2.0
timeSignature :String

The time signature of the musical composition contained in the audio/MIDI file.


# title

Availability
5.0.0
9.2.0
title :String

The title of the particular item.


# totalBitRate

Availability
5.0.0
9.2.0
totalBitRate :Number

The total bit rate (audio and video combined) of the media.


# url

Availability
5.0.0
9.2.0
url :String

URL of the item.


# version

Availability
5.0.0
9.2.0
version :String

A version specifier for this item.


# videoBitRate

Availability
5.0.0
9.2.0
videoBitRate :Number

The video bit rate.

# Methods

# addEventListener

Availability
5.0.0
9.2.0
addEventListener(name, callback) void

Adds the specified callback as an event listener for the named event.

Parameters

Name Type Description
name String

Name of the event.

callback Callback<Titanium.Event>

Callback function to invoke when the event is fired.

Returns

Type
void

# applyProperties

Availability
5.0.0
9.2.0
applyProperties(props) void

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.

Parameters

Name Type Description
props Dictionary

A dictionary of properties to apply.

Returns

Type
void

# fireEvent

Availability
5.0.0
9.2.0
fireEvent(name[, event]) void

Fires a synthesized event to any registered listeners.

Parameters

Name Type Description
name String

Name of the event.

event Dictionary

A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.

Returns

Type
void

# removeEventListener

Availability
5.0.0
9.2.0
removeEventListener(name, callback) void

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);

Parameters

Name Type Description
name String

Name of the event.

callback Callback<Titanium.Event>

Callback function to remove. Must be the same function passed to addEventListener.

Returns

Type
void