]> arthur.barton.de Git - netatalk.git/blobdiff - include/atalk/spotlight.h
Spotlight: new options for controlling query behaviour
[netatalk.git] / include / atalk / spotlight.h
index 56e093063ac987ea487ad1c3112a3961cb35b2a9..bafa52f53b83d9a88f714a0c5dddb8ffa3125992 100644 (file)
@@ -38,11 +38,12 @@ struct sl_module_export {
     int (*sl_mod_start_search)(void *);
     int (*sl_mod_fetch_result)(void *);
     int (*sl_mod_end_search)  (void *);
+    int (*sl_mod_fetch_attrs) (void *);
     int (*sl_mod_error)       (void *);
     int (*sl_mod_index_file)  (const void *);
 };
 
-extern int sl_mod_load(const char *path);
+extern int sl_mod_load(AFPObj *obj);
 extern void sl_index_file(const char *path);
 
 /**************************************************************************************************
@@ -84,32 +85,28 @@ typedef enum {
     SLQ_STATE_NEW      = 1,           /* Query received from client                                     */
     SLQ_STATE_RUNNING  = 2,           /* Query dispatched to Tracker                                    */
     SLQ_STATE_DONE     = 3,           /* Tracker finished                                               */
-    SLQ_STATE_END      = 4            /* Query results returned to client                               */
+    SLQ_STATE_END      = 4,           /* Query results returned to client                               */
+    SLQ_STATE_ATTRS    = 5            /* Fetch metadata for an object                                   */
 } slq_state_t;
 
 /* Internal query data structure */
 typedef struct _slq_t {
-    struct list_head slq_list;        /* queries are stored in a list                                   */
-    slq_state_t    slq_state;         /* State                                                          */
-    AFPObj         *slq_obj;          /* global AFPObj handle                                           */
-    const struct vol *slq_vol;        /* volume handle                                                  */
-    DALLOC_CTX     *slq_reply;        /* reply handle                                                   */
-    time_t         slq_time;          /* timestamp where we received this query                         */
-    uint64_t       slq_ctx1;          /* client context 1                                               */
-    uint64_t       slq_ctx2;          /* client context 2                                               */
-    sl_array_t     *slq_reqinfo;      /* array with requested metadata                                  */
-    const char     *slq_qstring;      /* the Spotlight query string                                     */
-    uint64_t       *slq_cnids;        /* Pointer to array with CNIDs to which a query applies           */
-    size_t         slq_cnids_num;    /* Size of slq_cnids array                                        */
-#ifdef HAVE_TRACKER_SPARQL
-    void           *slq_tracker_cursor; /* Tracker SPARQL query result cursor                           */
-#endif
-#ifdef HAVE_TRACKER_RDF
-    char          *slq_trackerquery;  /* RDF query string*/
-    char          *slq_fts;           /* FTS search string */
-    int            slq_service;       /* Tracker service */
-    int            slq_offset;        /* search offset */
-#endif
+    struct list_head  slq_list;           /* queries are stored in a list                                   */
+    slq_state_t       slq_state;          /* State                                                          */
+    AFPObj           *slq_obj;            /* global AFPObj handle                                           */
+    const struct vol *slq_vol;            /* volume handle                                                  */
+    DALLOC_CTX       *slq_reply;          /* reply handle                                                   */
+    time_t            slq_time;           /* timestamp where we received this query                         */
+    uint64_t          slq_ctx1;           /* client context 1                                               */
+    uint64_t          slq_ctx2;           /* client context 2                                               */
+    sl_array_t       *slq_reqinfo;        /* array with requested metadata                                  */
+    const char       *slq_qstring;        /* the Spotlight query string                                     */
+    uint64_t         *slq_cnids;          /* Pointer to array with CNIDs to which a query applies           */
+    size_t            slq_cnids_num;      /* Size of slq_cnids array                                        */
+    const char       *slq_path;           /* Path to file or dir, used in fetchAttributes                   */
+    void             *slq_tracker_cursor; /* Tracker SPARQL query result cursor                             */
+    bool              slq_allow_expr;     /* Whether to allow logic expressions                             */
+    uint64_t          slq_result_limit;   /* Whether to LIMIT SPARQL results, default of 0 means no limit   */
 } slq_t;
 
 /**************************************************************************************************
@@ -119,5 +116,6 @@ typedef struct _slq_t {
 extern int afp_spotlight_rpc(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen);
 extern int sl_pack(DALLOC_CTX *query, char *buf);
 extern int sl_unpack(DALLOC_CTX *query, const char *buf);
+extern void configure_spotlight_attributes(const char *attributes);
 
 #endif /* SPOTLIGHT_H */