I'm trying to find documents using this query: field:"value" OR (*:* AND NOT field:[* TO *])
Which means, either field is set to "value" or the field does not exist in the document. I'm running this for ~20 fields in a single query strung together with ANDs. The query time is high, averaging around 3.5s. Does anyone have suggestions on how to optimize this query? As a last resort, using technologies outside of Solr is a possibility. All suggestions are greatly appreciated! Thanks for your time and efforts, Artem PS. For the record, a colleague and I have brainstormed some idea of our own: * Adding a meta field to each document that consists of 1s and 0s, where each character represents a field's existence (1 yes, 0 no). In this case the query would look like: field:"value" OR signature:???????0??????? So we are looking for a certain field (the 0) that definitely does not exist and all the others we do not care about (wildcard). Note that this would have to be a leading wildcard query or we could prepend a dummy character to beginning. A bit of a hack. * Using bitwise operations to find all documents whose set of fields is a subset of they query's set of fields. This would be more work and would require writing a custom query parser or search handler.