YAZ  5.23.1
Macros | Functions
rpn2solr.c File Reference

Implements RPN to SOLR conversion. More...

#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <yaz/rpn2solr.h>
#include <yaz/xmalloc.h>
#include <yaz/diagbib1.h>
#include <yaz/z-core.h>
#include <yaz/wrbuf.h>

Go to the source code of this file.

Macros

#define SOLR_SPECIAL   "+-&|!(){}[]^\"~*?:\\"
 

Functions

static const char * lookup_index_from_string_attr (Z_AttributeList *attributes)
 
static const char * lookup_relation_index_from_attr (Z_AttributeList *attributes)
 
static int check_range (solr_transform_t ct, Z_Complex *q, Z_AttributesPlusTerm **p_apt1, Z_AttributesPlusTerm **p_apt2)
 
static int rpn2solr_attr (solr_transform_t ct, Z_AttributeList *attributes, WRBUF w)
 
static Odr_int get_truncation (Z_AttributesPlusTerm *apt)
 
static int emit_term (solr_transform_t ct, WRBUF w, Z_Term *term, Odr_int trunc)
 
static int rpn2solr_simple (solr_transform_t ct, void(*pr)(const char *buf, void *client_data), void *client_data, Z_AttributesPlusTerm *apt, WRBUF w, Z_AttributesPlusTerm *apt2)
 
static int rpn2solr_structure (solr_transform_t ct, void(*pr)(const char *buf, void *client_data), void *client_data, Z_RPNStructure *q, int nested, WRBUF w)
 
int solr_transform_rpn2solr_stream_r (solr_transform_t ct, WRBUF addinfo, void(*pr)(const char *buf, void *client_data), void *client_data, Z_RPNQuery *q)
 transforms RPN query to SOLR output stream (re-entrant) More...
 
int solr_transform_rpn2solr_stream (solr_transform_t ct, void(*pr)(const char *buf, void *client_data), void *client_data, Z_RPNQuery *q)
 transforms RPN query to SOLR output stream (NOT re-entrant) More...
 
int solr_transform_rpn2solr_wrbuf (solr_transform_t ct, WRBUF w, Z_RPNQuery *q)
 transforms RPN query to SOLR WRBUF More...
 

Detailed Description

Implements RPN to SOLR conversion.

Definition in file rpn2solr.c.

Macro Definition Documentation

#define SOLR_SPECIAL   "+-&|!(){}[]^\"~*?:\\"

Definition at line 203 of file rpn2solr.c.

Referenced by emit_term().

Function Documentation

static int check_range ( solr_transform_t  ct,
Z_Complex q,
Z_AttributesPlusTerm **  p_apt1,
Z_AttributesPlusTerm **  p_apt2 
)
static
static int emit_term ( solr_transform_t  ct,
WRBUF  w,
Z_Term term,
Odr_int  trunc 
)
static
static Odr_int get_truncation ( Z_AttributesPlusTerm apt)
static
static const char* lookup_index_from_string_attr ( Z_AttributeList attributes)
static
static const char* lookup_relation_index_from_attr ( Z_AttributeList attributes)
static
static int rpn2solr_attr ( solr_transform_t  ct,
Z_AttributeList attributes,
WRBUF  w 
)
static
static int rpn2solr_simple ( solr_transform_t  ct,
void(*)(const char *buf, void *client_data)  pr,
void *  client_data,
Z_AttributesPlusTerm apt,
WRBUF  w,
Z_AttributesPlusTerm apt2 
)
static
static int rpn2solr_structure ( solr_transform_t  ct,
void(*)(const char *buf, void *client_data)  pr,
void *  client_data,
Z_RPNStructure q,
int  nested,
WRBUF  w 
)
static
int solr_transform_rpn2solr_stream ( solr_transform_t  ct,
void(*)(const char *buf, void *client_data)  pr,
void *  client_data,
Z_RPNQuery q 
)

transforms RPN query to SOLR output stream (NOT re-entrant)

Parameters
ctSOLR transform handle
prprint function
client_dataopaque data to be passed to print handler
qRPN Query
Return values
0success
!=0failure (error code)

Definition at line 414 of file rpn2solr.c.

References solr_transform_rpn2solr_stream_r(), solr_transform_set_error(), wrbuf_alloc(), wrbuf_cstr(), wrbuf_destroy(), and wrbuf_len.

Referenced by solr_transform_rpn2solr_wrbuf().

int solr_transform_rpn2solr_stream_r ( solr_transform_t  ct,
WRBUF  addinfo,
void(*)(const char *buf, void *client_data)  pr,
void *  client_data,
Z_RPNQuery q 
)

transforms RPN query to SOLR output stream (re-entrant)

Parameters
ctSOLR transform handle
addinfoadditional info on error
prprint function
client_dataopaque data to be passed to print handler
qRPN Query
Return values
0success
!=0failure (error code)

Definition at line 401 of file rpn2solr.c.

References rpn2solr_structure(), Z_RPNQuery::RPNStructure, and wrbuf_rewind().

Referenced by solr_transform_rpn2solr_stream().

int solr_transform_rpn2solr_wrbuf ( solr_transform_t  ct,
WRBUF  w,
Z_RPNQuery q 
)

transforms RPN query to SOLR WRBUF

Parameters
ctSOLR transform handle
wWRBUF handle for result
qRPN Query
Return values
0success
!=0failure (error code)

Definition at line 427 of file rpn2solr.c.

References solr_transform_rpn2solr_stream(), and wrbuf_vp_puts().