Is it possible to evaluate a conditional on a list just once? That is, instead of iterating and applying the template to each element in the array, evaluate it as non-empty and do stuff in it only once. For example
if array is a non-empty list, and if empty the block is not evaluated. Tags with # and / are placeholders. Hope this makes sense.
Note: If this is syntactically not possible with mustache, we can obviously just surround all of the sub-queries with something like a bool-should block. This however necessitates some akward stuff with commas or a final match_all, match_none query.
Unfortunately this does not seem to be a use case which is covered by mustache ... anyway, we were able to restructure the query in a way that uses the elements of the array (which is probably what you'd rather do.)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.