/// <summary> Creates a new StandardTokenizer with a given
		/// <see cref="Lucene.Net.Util.AttributeSource.AttributeFactory" />
		/// </summary>
		public StandardTokenizer(Version matchVersion, AttributeFactory factory, System.IO.TextReader input):base(factory)
		{
			InitBlock();
			this.scanner = new StandardTokenizerImpl(input);
			Init(input, matchVersion);
		}
		private void  Init(System.IO.TextReader input, Version matchVersion)
		{
			if (matchVersion.OnOrAfter(Version.LUCENE_24))
			{
			    replaceInvalidAcronym = true;
			}
			else
			{
			    replaceInvalidAcronym = false;
			}
		    this.input = input;
		    termAtt = AddAttribute<ITermAttribute>();
		    offsetAtt = AddAttribute<IOffsetAttribute>();
		    posIncrAtt = AddAttribute<IPositionIncrementAttribute>();
		    typeAtt = AddAttribute<ITypeAttribute>();
		}
示例#3
0
        /* Constructs a query parser.
         *  @param matchVersion  Lucene version to match.  See <a href="#version">above</a>)
         *  @param f  the default field for query terms.
         *  @param a   used to find terms in the query text.
         */

        public QueryParser(Version matchVersion, String f, Analyzer a)
            : this(new FastCharStream(new StringReader("")))
        {
            analyzer = a;
            field = f;
            if (matchVersion.OnOrAfter(Version.LUCENE_29))
            {
                enablePositionIncrements = true;
            }
            else
            {
                enablePositionIncrements = false;
            }

            // LUCENENET-423 - DateRange differences with Java and .NET
            if (matchVersion.OnOrAfter(Version.LUCENE_30))
            {
                _useJavaStyleDateRangeParsing = true;
            }
        }