X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fsparql.c;h=6fe5e5c6b9741dab2ccfed04f78e761038fce5ed;hb=5ecaa3f8a96808ad83627fabe8849804aaebe4b9;hp=0f38d577c6ddf78b2b6aa997f749fcebe738730f;hpb=4485a14f767a62881d73b5b9c2993274d90b53bc;p=mp-sparql-moved-to-github.git diff --git a/src/sparql.c b/src/sparql.c index 0f38d57..6fe5e5c 100644 --- a/src/sparql.c +++ b/src/sparql.c @@ -540,6 +540,48 @@ int yaz_sparql_from_rpn_stream(yaz_sparql_t s, return errors ? -1 : r; } +void yaz_sparql_explain_indexes( yaz_sparql_t s, WRBUF w, int indent) +{ + char indentspace[200]; // must be enough + assert(indent<200); + int i; + for (i=0; i < indent; i++) + indentspace[i] = ' '; + indentspace[indent] = '\0'; + + struct sparql_entry *e; + wrbuf_puts(w,indentspace); + wrbuf_puts(w,"\n"); + + for (e = s->conf; e; e = e->next) + { + /* + wrbuf_puts(w," "); + wrbuf_xmlputs(w, e->pattern ); + wrbuf_puts(w," : "); + wrbuf_xmlputs(w, e->value ); + wrbuf_puts(w," \n"); + */ + if ( strncmp(e->pattern, "index.", 6 ) == 0 ) + { + wrbuf_puts(w,indentspace); + wrbuf_puts(w," \n"); + wrbuf_puts(w,indentspace); + wrbuf_puts(w," "); + wrbuf_xmlputs(w, e->pattern + 6); + wrbuf_puts(w,"\n"); + wrbuf_puts(w,indentspace); + wrbuf_puts(w," "); + wrbuf_xmlputs(w, e->pattern + 6); + wrbuf_puts(w,"\n"); + wrbuf_puts(w,indentspace); + wrbuf_puts(w," \n"); + } + } + wrbuf_puts(w,indentspace); + wrbuf_puts(w,"\n"); +} + /* * Local variables: * c-basic-offset: 4