I have a set of indexed fields such as these:

submitted_form_2200FA17-AF7A-4E44-9749-79D3A391A1AF:true

submitted_form_2398389-2-32-43242423:true

submitted_form_54543-32SDf-3242340-32422:true

And I get that it's possible to wildcard queries such as

submitted_form_2398389-2-32-43242423:t*e

What I'm trying to do is get "any" submitted form via something like:

submitted_form_*:true

Is this possible? Or will I have to do a stream of "OR"s on the known forms (which seems quite heavy)

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top