/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2009 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
#define CQL_NODE_ST 1
/** \brief Node type: boolean */
#define CQL_NODE_BOOL 2
+/** \brief Node type: sortby single spec */
+#define CQL_NODE_SORT 3
+
/** \brief CQL parse tree (node)
*/
struct cql_node {
/** modifiers (NULL for no list) */
struct cql_node *modifiers;
} boolean;
+ /** which == CQL_NODE_SORT */
+ struct {
+ char *index;
+ /** next spec */
+ struct cql_node *next;
+ /** modifiers (NULL for no list) */
+ struct cql_node *modifiers;
+ /** search node */
+ struct cql_node *search;
+ } sort;
} u;
};
YAZ_EXPORT
struct cql_node *cql_node_mk_boolean(NMEM nmem, const char *op);
+/** \brief creates a sort single spec node. */
+YAZ_EXPORT
+struct cql_node *cql_node_mk_sort(NMEM nmem, const char *index,
+ struct cql_node *modifiers);
+
/** \brief destroys a node and its children. */
YAZ_EXPORT
void cql_node_destroy(struct cql_node *cn);
YAZ_EXPORT
struct cql_node *cql_parser_result(CQL_parser cp);
+/** \brief returns the sortby tree of the most recently parsed CQL query.
+ \param cp CQL parser
+ \returns CQL node or NULL for failure
+*/
+YAZ_EXPORT
+struct cql_node *cql_parser_sort_result(CQL_parser cp);
+
/** \brief converts CQL tree to XCQL and writes to user-defined stream
\param cn CQL node (tree)
\param pr print function
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab