Also, it's more flexible. You can easily implement stricter checking on top of a "lax" model (use a term enumerator to see if the field exists before you call search), but not vice versa.
-Yonik On 4/14/05, Yonik Seeley <[EMAIL PROTECTED]> wrote: > Hmmm, that's a great lucene architecture question. > Should one be allowed to sort on a field that doesn't exist? > One *can* query on fields that don't exist (and that's correct in my view). > > The thing is, lucene field creation is lazy... just because the field > doesn't exist now doesn't mean that it won't exist later. The field > one is sorting on doesn't even have to exist in all the documents. I > think it would be even more confusing for an invalid query suddenly > becoming a valid query in the future just because someone added a doc > with that field indexed (esp since that doc may not even match the > query being sorted). > > In short, I think sorting should act like querying (no exception if > field doesn't exist yet). > > -Yonik > > On 4/14/05, Daniel Naber <[EMAIL PROTECTED]> wrote: > > On Thursday 14 April 2005 16:28, Yonik Seeley wrote: > > > > > I haven't tried it, but I think the fix should be easy... never throw > > > that exception. > > > > As Lucene does not have the concept of a "warning" I think it should throw > > exceptions when someone tries to do something that doesn't make sense > > (even if it's technically possible). And sorting on a field that doesn't > > exist doesn't seem to make sense. > > > > Well, searching on a field that doesn't exist won't give you an exception > > either. For debugging it would be useful if you'd get an exception instead > > of no results. > > > > Regards > > Daniel > > > > -- > > http://www.danielnaber.de > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]