fixing js indexes samples on query-optimization doc

the comments and the js samples do not make sense the way they are, so I swapped them.