YAZ  5.23.1
Data Structures | Functions
pquery.c File Reference

Implements PQF parsing. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <yaz/proto.h>
#include <yaz/oid_db.h>
#include <yaz/pquery.h>

Go to the source code of this file.

Data Structures

struct  yaz_pqf_parser
 

Functions

static Z_RPNStructurerpn_structure (struct yaz_pqf_parser *li, ODR o, int num_attr, int max_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set)
 
static Odr_oidquery_oid_getvalbyname (struct yaz_pqf_parser *li, ODR o)
 
static int compare_term (struct yaz_pqf_parser *li, const char *src, size_t off)
 
static int query_token (struct yaz_pqf_parser *li)
 
static int lex (struct yaz_pqf_parser *li)
 
static int escape_string (char *out_buf, const char *in, int len)
 
static int p_query_parse_attr (struct yaz_pqf_parser *li, ODR o, int num_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set)
 
static Z_AttributeListget_attributeList (ODR o, int num_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set)
 
Z_AttributeListzget_AttributeList_use_string (ODR o, const char *name)
 creates AttributeList with type=1(use) and string value More...
 
Z_Termz_Term_create (ODR o, int term_type, const char *buf, size_t len)
 
static Z_AttributesPlusTermrpn_term_attributes (struct yaz_pqf_parser *li, ODR o, Z_AttributeList *attributes)
 
static Z_AttributesPlusTermrpn_term (struct yaz_pqf_parser *li, ODR o, int num_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set)
 
static Z_Operandrpn_simple (struct yaz_pqf_parser *li, ODR o, int num_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set)
 
static Z_ProximityOperatorrpn_proximity (struct yaz_pqf_parser *li, ODR o)
 
static Z_Complexrpn_complex (struct yaz_pqf_parser *li, ODR o, int num_attr, int max_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set)
 
static void rpn_term_type (struct yaz_pqf_parser *li)
 
static Z_RPNQueryp_query_rpn_mk (ODR o, struct yaz_pqf_parser *li)
 
static void pqf_parser_begin (struct yaz_pqf_parser *li, const char *buf)
 
Z_RPNQueryp_query_rpn (ODR o, const char *qbuf)
 
static Z_AttributeListp_query_scan_attributes_mk (struct yaz_pqf_parser *li, ODR o, Odr_oid **attributeSetP)
 
static Z_AttributesPlusTermp_query_scan_mk (struct yaz_pqf_parser *li, ODR o, Odr_oid **attributeSetP)
 
YAZ_PQF_Parser yaz_pqf_create (void)
 
void yaz_pqf_destroy (YAZ_PQF_Parser p)
 
Z_RPNQueryyaz_pqf_parse (YAZ_PQF_Parser p, ODR o, const char *qbuf)
 
Z_AttributesPlusTermyaz_pqf_scan (YAZ_PQF_Parser p, ODR o, Odr_oid **attributeSetP, const char *qbuf)
 
Z_AttributeListyaz_pqf_scan_attribute_list (YAZ_PQF_Parser p, ODR o, Odr_oid **attributeSetP, const char *qbuf)
 
static Z_FacetFieldparse_facet (ODR odr, const char *facet)
 
Z_FacetListyaz_pqf_parse_facet_list (ODR o, const char *qbuf)
 
int yaz_pqf_error (YAZ_PQF_Parser p, const char **msg, size_t *off)
 

Detailed Description

Implements PQF parsing.

Definition in file pquery.c.

Function Documentation

static int compare_term ( struct yaz_pqf_parser li,
const char *  src,
size_t  off 
)
static

Definition at line 51 of file pquery.c.

References yaz_pqf_parser::lex_buf, and yaz_pqf_parser::lex_len.

Referenced by query_token(), and rpn_term_type().

static int escape_string ( char *  out_buf,
const char *  in,
int  len 
)
static

Definition at line 125 of file pquery.c.

Referenced by p_query_parse_attr(), parse_facet(), and rpn_term_attributes().

static Z_AttributeList* get_attributeList ( ODR  o,
int  num_attr,
Odr_int attr_list,
char **  attr_clist,
Odr_oid **  attr_set 
)
static
static int lex ( struct yaz_pqf_parser li)
static
static int p_query_parse_attr ( struct yaz_pqf_parser li,
ODR  o,
int  num_attr,
Odr_int attr_list,
char **  attr_clist,
Odr_oid **  attr_set 
)
static
Z_RPNQuery* p_query_rpn ( ODR  o,
const char *  qbuf 
)
static Z_RPNQuery* p_query_rpn_mk ( ODR  o,
struct yaz_pqf_parser li 
)
static
static Z_AttributeList* p_query_scan_attributes_mk ( struct yaz_pqf_parser li,
ODR  o,
Odr_oid **  attributeSetP 
)
static
static Z_AttributesPlusTerm* p_query_scan_mk ( struct yaz_pqf_parser li,
ODR  o,
Odr_oid **  attributeSetP 
)
static
static Z_FacetField* parse_facet ( ODR  odr,
const char *  facet 
)
static
static void pqf_parser_begin ( struct yaz_pqf_parser li,
const char *  buf 
)
static
static Odr_oid* query_oid_getvalbyname ( struct yaz_pqf_parser li,
ODR  o 
)
static
static int query_token ( struct yaz_pqf_parser li)
static
static Z_Complex* rpn_complex ( struct yaz_pqf_parser li,
ODR  o,
int  num_attr,
int  max_attr,
Odr_int attr_list,
char **  attr_clist,
Odr_oid **  attr_set 
)
static
static Z_ProximityOperator* rpn_proximity ( struct yaz_pqf_parser li,
ODR  o 
)
static
static Z_Operand* rpn_simple ( struct yaz_pqf_parser li,
ODR  o,
int  num_attr,
Odr_int attr_list,
char **  attr_clist,
Odr_oid **  attr_set 
)
static
static Z_RPNStructure * rpn_structure ( struct yaz_pqf_parser li,
ODR  o,
int  num_attr,
int  max_attr,
Odr_int attr_list,
char **  attr_clist,
Odr_oid **  attr_set 
)
static
static Z_AttributesPlusTerm* rpn_term ( struct yaz_pqf_parser li,
ODR  o,
int  num_attr,
Odr_int attr_list,
char **  attr_clist,
Odr_oid **  attr_set 
)
static

Definition at line 370 of file pquery.c.

References get_attributeList(), and rpn_term_attributes().

Referenced by rpn_simple().

static Z_AttributesPlusTerm* rpn_term_attributes ( struct yaz_pqf_parser li,
ODR  o,
Z_AttributeList attributes 
)
static
static void rpn_term_type ( struct yaz_pqf_parser li)
static
YAZ_PQF_Parser yaz_pqf_create ( void  )
void yaz_pqf_destroy ( YAZ_PQF_Parser  p)

Definition at line 811 of file pquery.c.

References xfree.

Referenced by ccl_rpn_query(), ccl_scan_query(), cql2pqf(), parse_facet(), srw_bend_scan(), and srw_bend_search().

int yaz_pqf_error ( YAZ_PQF_Parser  p,
const char **  msg,
size_t *  off 
)
Z_RPNQuery* yaz_pqf_parse ( YAZ_PQF_Parser  p,
ODR  o,
const char *  qbuf 
)

Definition at line 816 of file pquery.c.

References p_query_rpn_mk(), and pqf_parser_begin().

Referenced by ccl_rpn_query(), cql2pqf(), and srw_bend_search().

Z_FacetList* yaz_pqf_parse_facet_list ( ODR  o,
const char *  qbuf 
)
Z_AttributesPlusTerm* yaz_pqf_scan ( YAZ_PQF_Parser  p,
ODR  o,
Odr_oid **  attributeSetP,
const char *  qbuf 
)

Definition at line 824 of file pquery.c.

References p_query_scan_mk(), and pqf_parser_begin().

Referenced by ccl_scan_query(), and srw_bend_scan().

Z_AttributeList* yaz_pqf_scan_attribute_list ( YAZ_PQF_Parser  p,
ODR  o,
Odr_oid **  attributeSetP,
const char *  qbuf 
)

Definition at line 834 of file pquery.c.

References p_query_scan_attributes_mk(), and pqf_parser_begin().

Z_Term* z_Term_create ( ODR  o,
int  term_type,
const char *  buf,
size_t  len 
)
Z_AttributeList* zget_AttributeList_use_string ( ODR  o,
const char *  name 
)

creates AttributeList with type=1(use) and string value

Parameters
oODR for encoding
nameuse-value
Returns
attribute list with only one use-attribute

Definition at line 310 of file pquery.c.

References get_attributeList(), and odr_strdup().

Referenced by yaz_solr_decode_facet_field(), yaz_sru_facet_response(), and yaz_sru_proxy_decode_facet_field().