That's not the intended use of fields, I think. Field names aren't supposed to be the searchable values, field values are. Field names are supposed to be known a priori.
My suggestion is (if possible) to store the second part of the name as the field value, for instance: submitted_form:2398389-2-32-43242423
. submitted_from
would be the field known a priori, and the value could eventually be searched with a PrefixQuery
.
Anyway, you could access the collection of fields' names using IndexReader.getFieldNames()
in Lucene 3.x and this in Lucene 4.x. I wouldn't expect search performance there.