Hi,
Got this thought while eating noodles yesterday...

Couldn't one convert a non NO_NORMS field to a genuine NO_NORMS field by:
1. expanding an index to a multi-file index (if the index was a .cfs one)
2. removing the appropriate .fN file from the index directory
3. switching that omitNorms bit in FieldInfo

I'm not sure how possible or how hard 3. is, but I see this omitNorms bit in 
FieldInfo.read(IndexInput) and FieldInfo.write(IndexOutput).

Maybe something like:

  public void change(IndexInput input, IndexOutput output, boolean omitNorms) 
throws IOException {
    int size = input.readVInt();//read in the size
    for (int i = 0; i < size; i++) {
      String name = input.readString().intern();
      byte bits = input.readByte();
      boolean isIndexed = (bits & IS_INDEXED) != 0;
      boolean storeTermVector = (bits & STORE_TERMVECTOR) != 0;
      boolean storePositionsWithTermVector = (bits & 
STORE_POSITIONS_WITH_TERMVECTOR) != 0;
      boolean storeOffsetWithTermVector = (bits & STORE_OFFSET_WITH_TERMVECTOR) 
!= 0;
      // ignore what's in the index, use what the caller says it wants
      //boolean omitNorms = (bits & OMIT_NORMS) != 0;
      
      addInternal(name, isIndexed, storeTermVector, 
storePositionsWithTermVector, storeOffsetWithTermVector, omitNorms);

      write(output);
    }

I didn't try this, of course, but I'm curious if this general approach would 
work, at least in case of norms.  If it works for norms, maybe it would also 
work for other field attributes, if their data is stoerd in separate files and 
easily detachable from the other index files.

Thanks,
Otis


----- Original Message ----
From: Yonik Seeley <[EMAIL PROTECTED]>
To: java-user@lucene.apache.org
Sent: Tuesday, January 9, 2007 1:41:33 PM
Subject: Re: .sN (separate norms files) and NO_NORMS

On 1/9/07, Otis Gospodnetic <[EMAIL PROTECTED]> wrote:
> After a little digging/debugging, it seems to me that what I am seeing is 
> actually normal and expected behaviour.  Morever, it seems that once a Field 
> is indexed without it being NO_NORMS field, it is not really possible to make 
> it a trully NO_NORMS field.

Correct.  As with many index changes, reindexing from scratch is the
best way to go.

-Yonik
http://incubator.apache.org/solr Solr, the open-source Lucene search server

---------------------------------------------------------------------
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]

Reply via email to