doc
|
00001 /* 00002 Copyright 2001, 2012, Oracle and/or its affiliates. All rights reserved. 00003 Oracle and Java are registered trademarks of Oracle and/or its 00004 affiliates. Other names may be trademarks of their respective owners. 00005 UNIX is a registered trademark of The Open Group. 00006 00007 This software and related documentation are provided under a license 00008 agreement containing restrictions on use and disclosure and are 00009 protected by intellectual property laws. Except as expressly permitted 00010 in your license agreement or allowed by law, you may not use, copy, 00011 reproduce, translate, broadcast, modify, license, transmit, distribute, 00012 exhibit, perform, publish, or display any part, in any form, or by any 00013 means. Reverse engineering, disassembly, or decompilation of this 00014 software, unless required by law for interoperability, is prohibited. 00015 The information contained herein is subject to change without notice 00016 and is not warranted to be error-free. If you find any errors, please 00017 report them to us in writing. 00018 U.S. GOVERNMENT END USERS: Oracle programs, including any operating 00019 system, integrated software, any programs installed on the hardware, 00020 and/or documentation, delivered to U.S. Government end users are 00021 "commercial computer software" pursuant to the applicable Federal 00022 Acquisition Regulation and agency-specific supplemental regulations. 00023 As such, use, duplication, disclosure, modification, and adaptation 00024 of the programs, including any operating system, integrated software, 00025 any programs installed on the hardware, and/or documentation, shall be 00026 subject to license terms and license restrictions applicable to the 00027 programs. No other rights are granted to the U.S. Government. 00028 This software or hardware is developed for general use in a variety 00029 of information management applications. It is not developed or 00030 intended for use in any inherently dangerous applications, including 00031 applications that may create a risk of personal injury. If you use 00032 this software or hardware in dangerous applications, then you shall 00033 be responsible to take all appropriate fail-safe, backup, redundancy, 00034 and other measures to ensure its safe use. Oracle Corporation and its 00035 affiliates disclaim any liability for any damages caused by use of this 00036 software or hardware in dangerous applications. 00037 This software or hardware and documentation may provide access to or 00038 information on content, products, and services from third parties. 00039 Oracle Corporation and its affiliates are not responsible for and 00040 expressly disclaim all warranties of any kind with respect to 00041 third-party content, products, and services. Oracle Corporation and 00042 its affiliates will not be responsible for any loss, costs, or damages 00043 incurred due to your access to or use of third-party content, products, 00044 or services. 00045 */ 00046 00047 00048 #import <Three20/Three20.h> 00049 #import "EMPageableDataSource.h" 00050 00062 @interface EMSearch : NSObject<NSCopying, NSCoding> { 00063 NSString *_key, *_terms, *_opts; 00064 } 00065 @property (nonatomic, retain) NSString *key, *terms, *opts; 00066 00067 + (EMSearch *) searchWithKey:(NSString *)key terms:(NSString *)terms; 00068 + (EMSearch *) searchWithKey:(NSString *)key terms:(NSString *)terms opts:(NSString *)opts; 00069 - (id) initWithKey:(NSString *)key terms:(NSString *)terms; 00070 - (id) initWithKey:(NSString *)key terms:(NSString *)terms opts:(NSString *)opts; 00071 00072 @end 00073 00074 00075 #pragma mark - 00076 00077 00078 static const NSUInteger SORT_ORDER_ASCENDING = 0; 00079 static const NSUInteger SORT_ORDER_DESCENDING = 1; 00080 00084 @interface EMSort : NSObject<NSCopying, NSCoding> { 00085 NSString *_key, *_displayValue; 00086 NSUInteger _order; 00087 BOOL _momentary; 00088 00089 NSString *_ascendingIndicator; 00090 NSString *_descendingIndicator; 00091 } 00092 00096 @property (nonatomic, retain) NSString *key; 00097 00101 @property (nonatomic, retain) NSString *displayValue; 00102 00106 @property (nonatomic, assign) NSUInteger order; 00107 00114 @property (nonatomic, assign) BOOL momentary; 00115 00122 @property (nonatomic, retain) NSString *ascendingIndicator; 00123 00130 @property (nonatomic, retain) NSString *descendingIndicator; 00131 00132 + (EMSort *) sortWithKey:(NSString *)key displayValue:(NSString *)displayValue; 00133 - (id) initWithKey:(NSString *)key displayValue:(NSString *)displayValue; 00134 00135 + (EMSort *) sortWithKey:(NSString *)key order:(NSUInteger)order displayValue:(NSString *)displayValue; 00136 - (id) initWithKey:(NSString *)key order:(NSUInteger)order displayValue:(NSString *)displayValue; 00137 00138 + (EMSort *) sortWithKey:(NSString *)key order:(NSUInteger)order displayValue:(NSString *)displayValue momentary:(BOOL)momentary; 00139 - (id) initWithKey:(NSString *)key order:(NSUInteger)order displayValue:(NSString *)displayValue momentary:(BOOL)momentary; 00140 00147 - (BOOL) isEqual:(EMSort *)sort; 00148 00149 @end 00150 00151 00152 #pragma mark - 00153 00154 00164 @interface EMSearchQuery : NSObject<NSCopying, NSCoding> { 00165 NSMutableArray *_searches; 00166 00167 NSMutableArray *_appliedFacets; 00168 NSMutableArray *_hiddenFacets; 00169 NSMutableArray *_searchFacets; 00170 00171 NSMutableArray *_rangeFilters; 00172 NSString *_recordFilter; 00173 00174 NSMutableArray *_exposedFacets; 00175 BOOL _returnFacets; 00176 BOOL _exposeAllFacets; 00177 BOOL _didYouMeanEnabled; 00178 00179 NSMutableArray *_sorts; 00180 00181 NSInteger _offset; 00182 NSInteger _recordsPerPage; 00183 00184 BOOL _categoryQuery; 00185 00186 Class _recordType; 00187 00188 NSMutableArray *_recordSpecs; 00189 00190 NSMutableDictionary *_requestParameters; 00191 } 00192 00197 + (id) queryWithRecordType:(Class)recordType; 00198 00202 @property (nonatomic, retain) NSMutableArray *searches; 00203 00207 @property (nonatomic, retain) NSMutableArray *appliedFacets; 00208 00213 @property (nonatomic, retain) NSMutableArray *hiddenFacets; 00214 00218 @property (nonatomic, retain) NSMutableArray *rangeFilters; 00219 00225 @property (nonatomic, retain) NSString *recordFilter; 00226 00230 @property (nonatomic, retain) NSMutableArray *exposedFacets; 00231 00235 @property (nonatomic, retain) NSMutableArray *sorts; 00236 00243 @property (nonatomic, assign) NSInteger offset; 00244 00250 @property (nonatomic, assign) NSInteger recordsPerPage; 00251 00257 @property (nonatomic, assign) Class recordType; 00258 00270 @property (nonatomic, assign) BOOL returnFacets; 00271 00275 @property (nonatomic, assign) BOOL exposeAllFacets; 00276 00280 @property (nonatomic, retain) NSMutableArray *recordSpecs; 00281 00285 - (BOOL) isEmpty; 00286 00292 @property (nonatomic, assign) BOOL categoryQuery; 00293 00299 @property (nonatomic, assign) BOOL didYouMeanEnabled; 00300 00304 @property (nonatomic, retain) NSMutableDictionary *requestParameters; 00305 00309 - (void) augmentQuery:(EMSearchQuery *)query; 00310 00315 - (void) clearAllFilters:(BOOL)clearHidden; 00316 00317 @end 00318 00319 00320 #pragma mark - 00321 00322 00323 @class EMContentItem; 00324 00328 @interface EMSearchResult : NSObject { 00329 NSInteger _offset; 00330 NSMutableArray *_records; 00331 NSMutableArray *_facets; 00332 NSMutableArray *_searchFacets; 00333 NSInteger _totalRecords; 00334 00335 NSString *_title; 00336 00337 BOOL _categoryResult; 00338 00339 Class _recordType; 00340 00341 NSString *_didYouMean, *_autocorrect; 00342 00343 EMContentItem *_contentItem; 00344 } 00345 00349 - (id) initWithRecordType:(Class)recordType; 00350 00354 @property (nonatomic, assign) NSInteger offset; 00355 00359 @property (nonatomic, retain) NSMutableArray *records; 00360 00364 @property (nonatomic, retain) NSMutableArray *facets; 00365 00369 @property (nonatomic, retain) NSMutableArray *searchFacets; 00370 00375 @property (nonatomic, assign) NSInteger totalRecords; 00376 00380 @property (nonatomic, readonly) Class recordType; 00381 00385 @property (nonatomic, retain) NSString *title; 00386 00392 @property (nonatomic, assign) BOOL categoryResult; 00393 00397 @property (nonatomic, retain) NSString *didYouMean; 00398 00402 @property (nonatomic, retain) NSString *autocorrect; 00403 00407 @property (nonatomic, retain) EMContentItem *contentItem; 00408 00409 @end 00410 00411 00412 #pragma mark - 00413 00414 00418 @protocol EMURLSearchResponse <TTURLResponse> 00419 00423 - (id) initWithRecordType:(Class)recordType; 00424 00428 @property (nonatomic, readonly) EMSearchResult *result; 00429 00433 @property (nonatomic, readonly) Class recordType; 00434 00435 @end 00436 00437 00438 #pragma mark - 00439 00440 00444 @protocol EMSearchQueryDataSource <EMPageableDataSource> 00445 00452 @property(nonatomic, retain) EMSearchQuery *query; 00453 00459 @property(nonatomic, readonly) EMSearchResult *result; 00460 00465 - (void) submitQuery; 00466 00467 00468 @end 00469 00470 /* 00471 * @} 00472 * @} 00473 */