forbid empty field names?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

forbid empty field names?

Daniel Naber-5

This produces a "term out of order" exception:

doc.add(new Field("", "", Field.Store.YES, Field.Index.UN_TOKENIZED));

As the exception is quite confusing we should probably catch it earlier,
providing a better message. But would it be okay to disallow all empty
field names? If not, I'd at least like to throw an exception if both field
name and value are empty (null values do already produce a helpful
exception)

Regards
 Daniel

--
http://www.danielnaber.de

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: forbid empty field names?

Chris Hostetter-3


I'm curious: does the exception only occur if both the field and the value
are empty? ... are the Field.Store and Field.Index options you listed
neccessary for this condition as well?

Is it clear why this situation causes the exception?

(I don't have any obejction to rejecting blank field names .. i'm just
wondering if getting an the exception in this case is a symptom of a a
more general problem that could be fixed at a lower level)

: Date: Fri, 12 May 2006 23:37:14 +0200
: From: Daniel Naber <[hidden email]>
: Reply-To: [hidden email]
: To: [hidden email]
: Subject: forbid empty field names?
:
:
: This produces a "term out of order" exception:
:
: doc.add(new Field("", "", Field.Store.YES, Field.Index.UN_TOKENIZED));
:
: As the exception is quite confusing we should probably catch it earlier,
: providing a better message. But would it be okay to disallow all empty
: field names? If not, I'd at least like to throw an exception if both field
: name and value are empty (null values do already produce a helpful
: exception)
:
: Regards
:  Daniel
:
: --
: http://www.danielnaber.de
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: [hidden email]
: For additional commands, e-mail: [hidden email]
:



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: forbid empty field names?

Daniel Naber-5
On Freitag 12 Mai 2006 23:41, Chris Hostetter wrote:

> I'm curious: does the exception only occur if both the field and the
> value are empty?

Yes, and the field needs to be untokenized. Store doesn't matter.

> Is it clear why this situation causes the exception?

I haven't thought about that...

Regards
 Daniel

--
http://www.danielnaber.de

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]