Beispiel #1
0
 protected internal virtual void  SetStoreTermVector(Field.TermVector termVector)
 {
     if (termVector == Field.TermVector.NO)
     {
         this.storeTermVector             = false;
         this.storePositionWithTermVector = false;
         this.storeOffsetWithTermVector   = false;
     }
     else if (termVector == Field.TermVector.YES)
     {
         this.storeTermVector             = true;
         this.storePositionWithTermVector = false;
         this.storeOffsetWithTermVector   = false;
     }
     else if (termVector == Field.TermVector.WITH_POSITIONS)
     {
         this.storeTermVector             = true;
         this.storePositionWithTermVector = true;
         this.storeOffsetWithTermVector   = false;
     }
     else if (termVector == Field.TermVector.WITH_OFFSETS)
     {
         this.storeTermVector             = true;
         this.storePositionWithTermVector = false;
         this.storeOffsetWithTermVector   = true;
     }
     else if (termVector == Field.TermVector.WITH_POSITIONS_OFFSETS)
     {
         this.storeTermVector             = true;
         this.storePositionWithTermVector = true;
         this.storeOffsetWithTermVector   = true;
     }
     else
     {
         throw new System.ArgumentException("unknown termVector parameter " + termVector);
     }
 }
Beispiel #2
0
        protected internal AbstractField(System.String name, Field.Store store, Field.Index index, Field.TermVector termVector)
        {
            if (name == null)
            {
                throw new System.NullReferenceException("name cannot be null");
            }
            this.name = StringHelper.Intern(name);             // field names are interned

            if (store == Field.Store.YES)
            {
                this.isStored     = true;
                this.isCompressed = false;
            }
            else if (store == Field.Store.COMPRESS)
            {
                this.isStored     = true;
                this.isCompressed = true;
            }
            else if (store == Field.Store.NO)
            {
                this.isStored     = false;
                this.isCompressed = false;
            }
            else
            {
                throw new System.ArgumentException("unknown store parameter " + store);
            }

            if (index == Field.Index.NO)
            {
                this.isIndexed   = false;
                this.isTokenized = false;
            }
            else if (index == Field.Index.ANALYZED)
            {
                this.isIndexed   = true;
                this.isTokenized = true;
            }
            else if (index == Field.Index.NOT_ANALYZED)
            {
                this.isIndexed   = true;
                this.isTokenized = false;
            }
            else if (index == Field.Index.NOT_ANALYZED_NO_NORMS)
            {
                this.isIndexed   = true;
                this.isTokenized = false;
                this.omitNorms   = true;
            }
            else if (index == Field.Index.ANALYZED_NO_NORMS)
            {
                this.isIndexed   = true;
                this.isTokenized = true;
                this.omitNorms   = true;
            }
            else
            {
                throw new System.ArgumentException("unknown index parameter " + index);
            }

            this.isBinary = false;

            SetStoreTermVector(termVector);
        }