From 174b03578581f79852af95b878624013a15f540e Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 7 Oct 2014 19:38:42 +0200 Subject: [PATCH 1/1] Fix PQF to Solr conversion may produce invalid Solr query YAZ-792 Just deal with the empty PQF term and quote that as well. --- src/rpn2solr.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/rpn2solr.c b/src/rpn2solr.c index f790ea2..1a39204 100644 --- a/src/rpn2solr.c +++ b/src/rpn2solr.c @@ -228,9 +228,14 @@ static int emit_term(solr_transform_t ct, WRBUF w, Z_Term *term, Odr_int trunc) size_t i; int must_quote = 0; - for (i = 0 ; i < lterm; i++) - if (sterm[i] == ' ') - must_quote = 1; + if (lterm == 0) + must_quote = 1; + else + { + for (i = 0 ; i < lterm; i++) + if (sterm[i] == ' ') + must_quote = 1; + } if (must_quote) wrbuf_puts(w, "\""); if (trunc == 2 || trunc == 3) -- 1.7.10.4