// to do a collection scan in those cases where somebody
// typed an element or attribute name incorrectly.
IndexPattern pattern = iq.getPattern();
Indexer idx = context.getIndexManager().getBestIndexer(Indexer.STYLE_NODEVALUE, pattern);
if ( idx != null )
return new NamedKeys(nk.name, nk.attribute, QueryEngine.getUniqueKeys(idx.queryMatches(iq)));
else if ( autoIndex ) {
// TODO: This has to *not* be hardcoded
Element e = new DocumentImpl().createElement("index");
e.setAttribute("class", "org.apache.xindice.core.indexer.ValueIndexer");
e.setAttribute("name", "xp_"+ps);