Mac Developer Library

Developer

AddressBook Framework Reference ABSearchElement Class Reference

Options
Deployment Target:

On This Page
Language:

ABSearchElement

Inheritance


Conforms To


Import Statement


Swift

import AddressBook

Objective-C

@import AddressBook;

Availability


Available in OS X v10.2 and later.

The ABSearchElement class is used to specify a search query for records in the Address Book database.

The ABSearchElement class is “toll-free bridged” with its procedural C opaque-type counterpart. This means that the ABSearchElementRef type is interchangeable in function or method calls with instances of the ABSearchElement class.

  • Returns a compound search element, created by combining the search elements in an array with the given conjunction.

    Declaration

    Swift

    init!(forConjunction conjunction: ABSearchConjunction, children children: [AnyObject]!) -> ABSearchElement

    Objective-C

    + (ABSearchElement *)searchElementForConjunction:(ABSearchConjunction)conjunction children:(NSArray *)children

    Parameters

    conjunction

    The logical operator with which to combine the search elements.

    children

    An array of search elements to be combined.

    Return Value

    A compound search element, created by combining the given search elements with the given conjunction

    Discussion

    The objects in the children array must be ABSearchElement objects. The conjunction can be kABSearchAnd or kABSearchOr. If children is nil or empty, this method raises an exception.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in OS X v10.2 and later.

  • Logical operators used to combine search elements.

    Declaration

    Swift

    typealias ABSearchConjunction = CFIndex

    Objective-C

    enum _ABSearchConjunction { kABSearchAnd, kABSearchOr }; typedef CFIndex ABSearchConjunction;

    Constants

    • kABSearchAnd

      kABSearchAnd

      Join the search elements together with the AND operand.

      Available in OS X v10.2 and later.

    • kABSearchOr

      kABSearchOr

      Join the search elements together with the OR operand.

      Available in OS X v10.2 and later.

    Discussion

    These constants are used by the searchElementForConjunction:children: method.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in OS X v10.2 and later.

  • Comparisons used to construct search elements.

    Declaration

    Swift

    typealias ABSearchComparison = CFIndex

    Objective-C

    enum _ABSearchComparison { kABEqual, kABNotEqual, kABLessThan, kABLessThanOrEqual, kABGreaterThan, kABGreaterThanOrEqual, kABEqualCaseInsensitive, kABContainsSubString, kABContainsSubStringCaseInsensitive, kABPrefixMatch, kABPrefixMatchCaseInsensitive, kABBitsInBitFieldMatch, kABDoesNotContainSubString, kABDoesNotContainSubStringCaseInsensitive, kABNotEqualCaseInsensitive, kABSuffixMatch, kABSuffixMatchCaseInsensitive, kABWithinIntervalAroundToday, kABWithinIntervalAroundTodayYearless, kABNotWithinIntervalAroundToday, kABNotWithinIntervalAroundTodayYearless, kABWithinIntervalFromToday, kABWithinIntervalFromTodayYearless, kABNotWithinIntervalFromToday, kABNotWithinIntervalFromTodayYearless }; typedef CFIndex ABSearchComparison;

    Constants

    • kABEqual

      kABEqual

      Search for elements that are equal to the value.

      Available in OS X v10.2 and later.

    • kABNotEqual

      kABNotEqual

      Search for elements that are not equal to the value.

      Available in OS X v10.2 and later.

    • kABLessThan

      kABLessThan

      Search for elements that are less than the value.

      Available in OS X v10.2 and later.

    • kABLessThanOrEqual

      kABLessThanOrEqual

      Search for elements that are less than or equal to the value.

      Available in OS X v10.2 and later.

    • kABGreaterThan

      kABGreaterThan

      Search for elements that are greater than the value.

      Available in OS X v10.2 and later.

    • kABGreaterThanOrEqual

      kABGreaterThanOrEqual

      Search for elements that are greater than or equal to the value.

      Available in OS X v10.2 and later.

    • kABEqualCaseInsensitive

      kABEqualCaseInsensitive

      Search for elements that are equal to the value, ignoring case.

      Available in OS X v10.2 and later.

    • kABContainsSubString

      kABContainsSubString

      Search for elements that contain the value.

      Available in OS X v10.2 and later.

    • kABContainsSubStringCaseInsensitive

      kABContainsSubStringCaseInsensitive

      Search for elements that contain the value, ignoring case.

      Available in OS X v10.2 and later.

    • kABPrefixMatch

      kABPrefixMatch

      Search for elements that begin with the value.

      Available in OS X v10.2 and later.

    • kABPrefixMatchCaseInsensitive

      kABPrefixMatchCaseInsensitive

      Search for elements that begin with the value, ignoring case.

      Available in OS X v10.2 and later.

    • kABBitsInBitFieldMatch

      kABBitsInBitFieldMatch

      Search for elements that match the bits in ABPersonFlags.

      Available in OS X v10.3 and later.

    • kABDoesNotContainSubString

      kABDoesNotContainSubString

      Search for elements that do not contain the value.

      Available in OS X v10.4 and later.

    • kABDoesNotContainSubStringCaseInsensitive

      kABDoesNotContainSubStringCaseInsensitive

      Search for elements that do not contain the value, ignoring case.

      Available in OS X v10.4 and later.

    • kABNotEqualCaseInsensitive

      kABNotEqualCaseInsensitive

      Search for elements that are not equal to the value, ignoring case.

      Available in OS X v10.4 and later.

    • kABSuffixMatch

      kABSuffixMatch

      Search for elements that end with the value.

      Available in OS X v10.4 and later.

    • kABSuffixMatchCaseInsensitive

      kABSuffixMatchCaseInsensitive

      Search for elements that end with the value, ignoring case.

      Available in OS X v10.4 and later.

    • kABWithinIntervalAroundToday

      kABWithinIntervalAroundToday

      Search for elements that are within a time interval (in seconds) forward or backward from today.

      Available in OS X v10.4 and later.

    • kABWithinIntervalAroundTodayYearless

      kABWithinIntervalAroundTodayYearless

      Search for elements that are within a time interval (in seconds) forward or backward from this day in any year.

      Available in OS X v10.4 and later.

    • kABNotWithinIntervalAroundToday

      kABNotWithinIntervalAroundToday

      Search for elements that are not within a time interval (in seconds) forward or backward from today.

      Available in OS X v10.4 and later.

    • kABNotWithinIntervalAroundTodayYearless

      kABNotWithinIntervalAroundTodayYearless

      Search for elements that are not within a time interval (in seconds) forward or backward from this day in any year.

      Available in OS X v10.4 and later.

    • kABWithinIntervalFromToday

      kABWithinIntervalFromToday

      Search for elements that are within a time interval (in seconds) forward from today.

      Available in OS X v10.4 and later.

    • kABWithinIntervalFromTodayYearless

      kABWithinIntervalFromTodayYearless

      Search for elements that are within a time interval (in seconds) forward from this day in any year.

      Available in OS X v10.4 and later.

    • kABNotWithinIntervalFromToday

      kABNotWithinIntervalFromToday

      Search for elements that are not within a time interval (in seconds) forward from today.

      Available in OS X v10.4 and later.

    • kABNotWithinIntervalFromTodayYearless

      kABNotWithinIntervalFromTodayYearless

      Search for elements that are not within a time interval (in seconds) forward from this day in any year.

      Available in OS X v10.4 and later.

    Discussion

    These constants are used by the ABPerson method searchElementForProperty:label:key:value:comparison: and the ABGroup method searchElementForProperty:label:key:value:comparison:

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in OS X v10.2 and later.