Hi,
a typical integration of search:suggest is to use it as the data
provider for, for example, the jquery autocomplete.
using search:suggest I might get a sequence of strings:
"A "Credit Crunch"?"
"A Avaliação dos Alunos"
"A Balancing Act"
"A Better World for All"
"A Bigger Picture"
wrapping the search:suggest in xdmp:to-json gives me this:
["\"A \"Credit Crunch\"?\"", "\"A Avalia\u00E7\u00E3o dos Alunos\"",
"\"A Balancing Act\"", "\"A Better World for All\"", "\"A Bigger
Picture\""]
I would very much like to see an option in xdmp:to-json that would not
wrap another set of quotes around each item; in a perfect world this
is the result I'd like to see:
["A \"Credit Crunch\"?", "A Avalia\u00E7\u00E3o dos Alunos", "A
Balancing Act", "A Better World for All", "A Bigger Picture"]
So, is there an easier option than trimming via a nested
replace(replace()) the left and right quote marks (if they exist,
single results aren't apparently quoted) of each element in the
sequence, and then concat-ing and string-join-ing like this (not even
sure that would work):
concat(
'["',
string-join(
search:suggest($term, $options, 5), '","'
),
'"]'):)
Right now the integration of jquery autocomplete and search:suggest
seems quite cumbersome (but I may overlook the obvious solution, for
sure!).
Thanks for your advice,
Jakob.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general