X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fsolrtransform.c;h=2d8743b1752ec2c2ebb4529a21b8c806e5d2d92c;hb=57714653dbb646c4831568e35d9065dc54502346;hp=2d4104457fe2f27a9915dcd95e31abb82b94fac4;hpb=dfeb387a4744dd3c7ed9df15b3306ae6c35fa22e;p=yaz-moved-to-github.git diff --git a/src/solrtransform.c b/src/solrtransform.c index 2d41044..2d8743b 100644 --- a/src/solrtransform.c +++ b/src/solrtransform.c @@ -1,27 +1,18 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data + * Copyright (C) 1995-2012 Index Data * See the file LICENSE for details. */ - /** * \file solrtransform.c * \brief Implements SOLR transform (SOLR to RPN conversion). - * - * Evaluation order of rules: - * - * always - * relation - * structure - * position - * truncation - * index - * relationModifier */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include -#include #include #include #include @@ -50,7 +41,7 @@ struct solr_transform_t_ { }; -/* TODO Utility functions, evt. split out int separate file */ +/* TODO Utility functions, split out into separate file */ int solr_strcmp(const char *s1, const char *s2) { return cql_strcmp(s1, s2); } @@ -79,7 +70,7 @@ void solr_buf_write_handler (const char *b, void *client_data) } -/* Utillity functions end */ +/* Utility functions end */ solr_transform_t solr_transform_create(void) { @@ -168,7 +159,7 @@ static int solr_transform_parse_tok_line(solr_transform_t ct, break; } value_str = yaz_tok_parse_string(tp); - if (isdigit(*value_str)) + if (yaz_isdigit(*value_str)) { elem->which = Z_AttributeValue_numeric; elem->value.numeric = @@ -531,8 +522,7 @@ static int solr_pr_prox(solr_transform_t ct, struct solr_node *mods, void *client_data) { int exclusion = 0; - int distance; /* to be filled in later depending on unit */ - int distance_defined = 0; + int distance = -1; int ordered = 0; int proxrel = 2; /* less than or equal */ int unit = 2; /* word */ @@ -545,7 +535,6 @@ static int solr_pr_prox(solr_transform_t ct, struct solr_node *mods, if (!strcmp(name, "distance")) { distance = strtol(term, (char**) 0, 0); - distance_defined = 1; if (!strcmp(relation, "=")) proxrel = 3; else if (!strcmp(relation, ">")) @@ -595,7 +584,7 @@ static int solr_pr_prox(solr_transform_t ct, struct solr_node *mods, mods = mods->u.st.modifiers; } - if (!distance_defined) + if (distance == -1) distance = (unit == 2) ? 1 : 0; solr_pr_int(exclusion, pr, client_data);