28 aug 2008 kl. 11.46 skrev Andrzej Bialecki:

Karl Wettin wrote:
28 aug 2008 kl. 10.58 skrev Dino Korah:
Document doc = new Document();
Field f = new Field("body", bodyText, Field.Store.NO,
Field.Index.TOKENIZED);
f.setOmitNorms(true);

Would that be equivalent to

Document doc = new Document();
Field f = new Field("body", bodyText, Field.Store.NO ,Field.Index.NO_NORMS);

And Field.Index.TOKENIZED has no effect after f.setOmitNorms(true); ?
Yes, those two have the same effect.

I don't think so - these two scenarios are different.

When you create a Field using Index.NO_NORMS, the constructor makes sure that:
     isIndexed = true;
     isTokenized = false;
     omitNorms = true;

When you create a Field using Index.TOKENIZED, the constructor sets these flags:
     isIndexed = true;
     isTokenized = true;

Then, when you call setOmitNorms(true), it does NOT affect isTokenized, it sets only omitNorms. So the flags are set now like this:
     isIndexed = true;
     isTokenized = true;
     omitNorms = true;

The end result of processing such a field is (I believe) conceptually equivalent to adding as many Fields as there are tokens, each with omitNorms=true.

Oh, you are of course right, I was too quick to read. Sorry.


      karl


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to