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.


--
Best regards,
Andrzej Bialecki     <><
 ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com


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

Reply via email to