Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldNormal"/> class.
 /// </summary>
 /// <param name="fieldName">Name of the field.</param>
 /// <param name="fieldValue">The field value.</param>
 /// <param name="storeValueInIndex">if set to <c>true</c> [store value in index].</param>
 /// <param name="indexMethod">The index method.</param>
 /// <param name="termVector">The term vector.</param>
 public FieldNormal(string fieldName, string fieldValue, bool storeValueInIndex, FieldSearchableRule indexMethod, FieldVectorRule termVector)
     : base(fieldName, fieldValue, StaticValues.DefaultBoost, storeValueInIndex)
 {
     if (this.IsFieldStored == false && indexMethod == FieldSearchableRule.No)
         throw new InvalidOperationException("You cannot set a field to be not stored and not indexed");
     this.indexMethod = indexMethod;
     this.termVector = termVector;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldNormal"/> class.
 /// </summary>
 /// <param name="fieldName">Name of the field.</param>
 /// <param name="fieldValue">The field value.</param>
 /// <param name="storeValueInIndex">if set to <c>true</c> [store value in index].</param>
 /// <param name="indexMethod">The index method.</param>
 /// <param name="termVector">The term vector.</param>
 public FieldNormal(string fieldName, string fieldValue, bool storeValueInIndex, FieldSearchableRule indexMethod, FieldVectorRule termVector)
     : base(fieldName, fieldValue, StaticValues.DefaultBoost, storeValueInIndex)
 {
     if (this.IsFieldStored == false && indexMethod == FieldSearchableRule.No)
     {
         throw new InvalidOperationException("You cannot set a field to be not stored and not indexed");
     }
     this.indexMethod = indexMethod;
     this.termVector  = termVector;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Converts a <see cref="IndexLibrary.FieldSearchableRule"/> to the Lucene equivalent object, <c>Field.Index</c>
 /// </summary>
 /// <param name="index">The <c>FieldSearchableRule</c> to convert into a Lucene object</param>
 /// <returns>A Lucene <c>Field.Index</c> that is equivalent to the specified <c>FieldSearchableRule</c></returns>
 public static Field.Index ConvertToLuceneFieldIndex(FieldSearchableRule index)
 {
     switch (index) {
         case FieldSearchableRule.Analyzed:
             return Field.Index.ANALYZED;
         case FieldSearchableRule.AnalyzedNoNorms:
             return Field.Index.ANALYZED_NO_NORMS;
         case FieldSearchableRule.NotAnalyzed:
             return Field.Index.NOT_ANALYZED;
         case FieldSearchableRule.NotAnalyzedNoNorms:
             return Field.Index.NOT_ANALYZED_NO_NORMS;
         case FieldSearchableRule.No:
         default:
             return Field.Index.NO;
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Converts a <see cref="IndexLibrary.FieldSearchableRule"/> to the Lucene equivalent object, <c>Field.Index</c>
        /// </summary>
        /// <param name="index">The <c>FieldSearchableRule</c> to convert into a Lucene object</param>
        /// <returns>A Lucene <c>Field.Index</c> that is equivalent to the specified <c>FieldSearchableRule</c></returns>
        public static Field.Index ConvertToLuceneFieldIndex(FieldSearchableRule index)
        {
            switch (index)
            {
            case FieldSearchableRule.Analyzed:
                return(Field.Index.ANALYZED);

            case FieldSearchableRule.AnalyzedNoNorms:
                return(Field.Index.ANALYZED_NO_NORMS);

            case FieldSearchableRule.NotAnalyzed:
                return(Field.Index.NOT_ANALYZED);

            case FieldSearchableRule.NotAnalyzedNoNorms:
                return(Field.Index.NOT_ANALYZED_NO_NORMS);

            case FieldSearchableRule.No:
            default:
                return(Field.Index.NO);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldStorage"/> class.
 /// </summary>
 /// <param name="isStored">if set to <c>true</c> the field [is stored].</param>
 /// <param name="fieldSearchRule">The field search rule.</param>
 /// <param name="fieldVectorRule">The field vector rule.</param>
 public FieldStorage(bool isStored, FieldSearchableRule fieldSearchRule, FieldVectorRule fieldVectorRule)
 {
     this.store = isStored;
     this.searchRule = fieldSearchRule;
     this.vectorRule = fieldVectorRule;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldStorage"/> class.
 /// </summary>
 /// <param name="isStored">if set to <c>true</c> the field [is stored].</param>
 /// <param name="fieldSearchRule">The field search rule.</param>
 public FieldStorage(bool isStored, FieldSearchableRule fieldSearchRule)
     : this(isStored, fieldSearchRule, FieldVectorRule.No)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldStorage"/> class.
 /// </summary>
 /// <param name="isStored">if set to <c>true</c> the field [is stored].</param>
 /// <param name="fieldSearchRule">The field search rule.</param>
 /// <param name="fieldVectorRule">The field vector rule.</param>
 public FieldStorage(bool isStored, FieldSearchableRule fieldSearchRule, FieldVectorRule fieldVectorRule)
 {
     this.store      = isStored;
     this.searchRule = fieldSearchRule;
     this.vectorRule = fieldVectorRule;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldStorage"/> class.
 /// </summary>
 /// <param name="isStored">if set to <c>true</c> the field [is stored].</param>
 /// <param name="fieldSearchRule">The field search rule.</param>
 public FieldStorage(bool isStored, FieldSearchableRule fieldSearchRule)
     : this(isStored, fieldSearchRule, FieldVectorRule.No)
 {
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldNormal"/> class.
 /// </summary>
 /// <param name="fieldName">Name of the field.</param>
 /// <param name="fieldValue">The field value.</param>
 /// <param name="storeValueInIndex">if set to <c>true</c> [store value in index].</param>
 /// <param name="indexMethod">The index method.</param>
 public FieldNormal(string fieldName, string fieldValue, bool storeValueInIndex, FieldSearchableRule indexMethod)
     : this(fieldName, fieldValue, storeValueInIndex, indexMethod, FieldVectorRule.No)
 {
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldNormal"/> class.
 /// </summary>
 /// <param name="fieldName">Name of the field.</param>
 /// <param name="fieldValue">The field value.</param>
 /// <param name="storeValueInIndex">if set to <c>true</c> [store value in index].</param>
 /// <param name="indexMethod">The index method.</param>
 public FieldNormal(string fieldName, string fieldValue, bool storeValueInIndex, FieldSearchableRule indexMethod)
     : this(fieldName, fieldValue, storeValueInIndex, indexMethod, FieldVectorRule.No)
 {
 }