lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerard Sychay" <Gerard.Syc...@cchmc.org>
Subject Re: Field.java -> STORED, NOT_STORED, etc...
Date Mon, 12 Jul 2004 21:07:20 GMT
I think this is a great idea.

I've never used the Field.Keyword and Field.Text type methods because I
can never remember what their 3-boolean-argument equivalents are. I
always stick the constructor format in a comment somewhere and use it.

>>> Doug Cutting <cutting@apache.org> 07/11/04 12:03PM >>>
Doug Cutting wrote:
> The calls would look like:
> 
> new Field("name", "value", Stored.YES, Indexed.NO, Tokenized.YES);
> 
> Stored could be implemented as the nested class:
> 
> public final class Stored {
>   private Stored() {}
>   public static final Stored YES = new Stored();
>   public static final Stored NO = new Stored();
> }

Actually, while we're at it, Indexed and Tokenized are confounded.  A 
single entry would be better, something like:

public final class Index {
   private Index() {}
   public static final Index NO = new Index();
   public static final Index TOKENIZED = new Index();
   public static final Index UN_TOKENIZED = new Index();
}

then calls would look like just:

new Field("name", "value", Store.YES, Index.TOKENIZED);

BTW, I think Stored would be better named Store too.

BooleanQuery's required and prohibited flags could get the same 
treatment, with the addition of a nested class like:

public final class Occur {
   private Occur() {}
   public static final Occur MUST_NOT = new Occur();
   public static final Occur SHOULD = new Occur();
   public static final Occur MUST = new Occur();
}

and adding a boolean clause would look like:

booleanQuery.add(new TermQuery(...), Occur.MUST);

Then we can deprecate the old methods.

Comments?

Doug

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message