YAZ  5.23.1
Functions
cql_sortkeys.c File Reference

CQL sortkeys utilities. More...

#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <yaz/wrbuf.h>
#include <yaz/cql.h>

Go to the source code of this file.

Functions

static void pr_n (void(*pr)(const char *buf, void *client_data), const char *buf, int len, void *client_data)
 
static int cql_sort_modifiers (struct cql_node *cn, void(*pr)(const char *buf, void *client_data), void *client_data)
 
int cql_sortby_to_sortkeys (struct cql_node *cn, void(*pr)(const char *buf, void *client_data), void *client_data)
 converts CQL sortby to sortkeys (ala versions 1.1) More...
 
int cql_sortby_to_sortkeys_buf (struct cql_node *cn, char *out, int max)
 converts CQL sortby to sortkeys .. More...
 

Detailed Description

CQL sortkeys utilities.

Definition in file cql_sortkeys.c.

Function Documentation

static int cql_sort_modifiers ( struct cql_node cn,
void(*)(const char *buf, void *client_data)  pr,
void *  client_data 
)
static

Definition at line 44 of file cql_sortkeys.c.

References cql_node::st, and cql_node::u.

Referenced by cql_sortby_to_sortkeys().

int cql_sortby_to_sortkeys ( struct cql_node cn,
void(*)(const char *buf, void *client_data)  pr,
void *  client_data 
)

converts CQL sortby to sortkeys (ala versions 1.1)

Parameters
cnCQL tree
prprint function
client_datadata to be passed to pr function

This will take CQL_NODE_SORT entries and conver them to

path,schema,ascending,caseSensitive,missingValue items..

One for each sort keys. Where

path is string index for sorting

schema is schema for sort index

ascending is a boolean (0=false, 1=true). Default is true.

caseSensitive is a boolean. Default is false.

missingValue is a string and one of 'abort', 'highValue', 'lowValue', or 'omit'. Default is 'highValue'.

See also http://www.loc.gov/standards/sru/sru-1-1.html#sort

Definition at line 83 of file cql_sortkeys.c.

References CQL_NODE_SORT, cql_sort_modifiers(), pr_n(), cql_node::sort, cql_node::u, and cql_node::which.

Referenced by cql_sortby_to_sortkeys_buf().

int cql_sortby_to_sortkeys_buf ( struct cql_node cn,
char *  out,
int  max 
)

converts CQL sortby to sortkeys ..

Parameters
cnCQL tree
outresult buffer
maxsize of buffer (allocated)
Return values
0OK
-1ERROR

Definition at line 120 of file cql_sortkeys.c.

References cql_buf_write_info::buf, cql_buf_write_handler(), cql_sortby_to_sortkeys(), cql_buf_write_info::max, and cql_buf_write_info::off.

Referenced by cql2pqf().

static void pr_n ( void(*)(const char *buf, void *client_data)  pr,
const char *  buf,
int  len,
void *  client_data 
)
static

Definition at line 20 of file cql_sortkeys.c.

Referenced by cql_sortby_to_sortkeys().