/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2011 Index Data
+ * Copyright (C) 1995-2013 Index Data
* See the file LICENSE for details.
*/
/**
switch (*relation)
{
/* Unsure on whether this is the relation attribute constants? */
- case Z_ProximityOperator_Prox_lessThan:
+ case Z_ProximityOperator_Prox_lessThan:
return "<";
- case Z_ProximityOperator_Prox_lessThanOrEqual:
- return "<=";
- case Z_ProximityOperator_Prox_equal:
- return "=";
- case Z_ProximityOperator_Prox_greaterThanOrEqual:
- return ">=";
- case Z_ProximityOperator_Prox_greaterThan:
- return ">";
- case Z_ProximityOperator_Prox_notEqual:
- return "<>";
- case 100:
+ case Z_ProximityOperator_Prox_lessThanOrEqual:
+ return "<=";
+ case Z_ProximityOperator_Prox_equal:
+ return "=";
+ case Z_ProximityOperator_Prox_greaterThanOrEqual:
+ return ">=";
+ case Z_ProximityOperator_Prox_greaterThan:
+ return ">";
+ case Z_ProximityOperator_Prox_notEqual:
+ return "<>";
+ case 100:
/* phonetic is not supported in CQL */
- return 0;
- case 101:
+ return 0;
+ case 101:
/* stem is not supported in CQL */
- return 0;
- case 102:
+ return 0;
+ case 102:
/* relevance is supported in CQL, but not implemented yet */
- return 0;
+ return 0;
default:
/* Invalid relation */
return 0;
index = lookup_index_from_string_attr(attributes);
/* Attempt to fix bug #2978: Look for a relation attribute */
- if (!relation)
+ if (!relation)
relation = lookup_relation_index_from_attr(attributes);
if (!index)
if (trunc <= 3 || trunc == 100 || trunc == 102 || trunc == 104)
{
+ int quote_it = 0;
for (i = 0 ; i < lterm; i++)
if (strchr(" ()=></", sterm[i]))
+ {
+ quote_it = 1;
break;
- wrbuf_puts(w, "\"");
+ }
+ if (lterm == 0)
+ quote_it = 1;
+ if (quote_it)
+ wrbuf_puts(w, "\"");
if (trunc == 2 || trunc == 3)
wrbuf_puts(w, "*");
for (i = 0; i < lterm; i++)
}
if (trunc == 1 || trunc == 3)
wrbuf_puts(w, "*");
- wrbuf_puts(w, "\"");
+ if (quote_it)
+ wrbuf_puts(w, "\"");
}
else
{