Package org.apache.lucene.util

Examples of org.apache.lucene.util.Version


    Analyzer a = new Analyzer() {
      @Override
      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
        Tokenizer tokenizer = new KeywordTokenizer(reader);
        final boolean updateOffsets = random().nextBoolean();
        final Version version = updateOffsets ? Version.LUCENE_4_3 : TEST_VERSION_CURRENT;
        return new TokenStreamComponents(tokenizer, new TrimFilter(version, tokenizer, updateOffsets));
      }
    };
    checkOneTerm(a, "", "");
  }
View Full Code Here


   
        public Analyzer getAnalyzer()   { return new XMLAnalyzer(); }

        public  QueryParser getQueryParser()
        {
            Version version = LuceneUtils.currentVersion();
           
            return new MultiFieldQueryParser
                (
                 version,
                 getFieldNames(),
View Full Code Here

    ts.close();
  }

  /** */
  public final void testKeywordAttrTokens() throws IOException {
    final Version version = TEST_VERSION_CURRENT;

    Analyzer a = new MorfologikAnalyzer(version) {
      @Override
      protected TokenStreamComponents createComponents(String field, Reader reader) {
        final CharArraySet keywords = new CharArraySet(version, 1, false);
View Full Code Here

   * @param directory the Directory to initialize
   * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found
   */
  public static void initializeIndexIfNeeded(Directory directory) {
    //version doesn't really matter as we won't use the Analyzer
    Version version = Environment.DEFAULT_LUCENE_MATCH_VERSION;
    SimpleAnalyzer analyzer = new SimpleAnalyzer( version );
    try {
      if ( ! DirectoryReader.indexExists( directory ) ) {
        IndexWriterConfig iwriterConfig = new IndexWriterConfig( version, analyzer ).setOpenMode( OpenMode.CREATE );
        IndexWriter iw = new IndexWriter( directory, iwriterConfig );
View Full Code Here

    ts.close();
  }

  /** */
  public final void testKeywordAttrTokens() throws IOException {
    final Version version = TEST_VERSION_CURRENT;
    final DICTIONARY dictionary = DICTIONARY.COMBINED;

    Analyzer a = new MorfologikAnalyzer(version, dictionary) {
      @Override
      protected TokenStreamComponents createComponents(String field, Reader reader) {
View Full Code Here

    Analyzer a = new Analyzer() {
      @Override
      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
        Tokenizer tokenizer = new KeywordTokenizer(reader);
        final boolean updateOffsets = random().nextBoolean();
        final Version version = updateOffsets ? Version.LUCENE_43 : TEST_VERSION_CURRENT;
        return new TokenStreamComponents(tokenizer, new TrimFilter(version, tokenizer, updateOffsets));
      }
    };
    checkOneTermReuse(a, "", "");
  }
View Full Code Here

            // Create new analyzer
            if (cParamClasses.length > 0 && cParamClasses[0] == Version.class) {

                if (LOG.isDebugEnabled()) {
                    Version version = (Version) cParamValues[0];
                    LOG.debug(String.format("An explicit Version %s of lucene has been specified.", version.toString()));
                }

                // A lucene Version object has been provided, so it shall be used
                newAnalyzer = createInstance(clazz, cParamClasses, cParamValues);
View Full Code Here

      ReflectionManager reflectionManager, Set<XClass> optimizationBlackList, InstanceInitializer instanceInitializer) {

    if ( xClass == null ) {
      throw new AssertionFailure( "Unable to build a DocumentBuilderContainedEntity with a null class" );
    }
    final Version luceneVersion = context.getLuceneMatchVersion();

    this.passThroughAnalyzer = new PassThroughAnalyzer( luceneVersion );
    this.instanceInitalizer = instanceInitializer;
    this.entityState = EntityState.CONTAINED_IN_ONLY;
    this.beanXClass = xClass;
View Full Code Here

    String parsedMatchVersion = matchVersion.toUpperCase( Locale.ENGLISH );

    // be lenient with the supplied version parameter
    parsedMatchVersion = parsedMatchVersion.replaceFirst( "^(\\d)\\.(\\d)$", "LUCENE_$1$2" );

    final Version version;
    try {
      version = Version.valueOf( parsedMatchVersion );
    }
    catch ( IllegalArgumentException iae ) {
      throw new SolrException(
View Full Code Here

      return false;
    }
  }

  private Version getLuceneMatchVersion(SearchConfiguration cfg) {
    Version version;
    String tmp = cfg.getProperty( Environment.LUCENE_MATCH_VERSION );
    if ( StringHelper.isEmpty( tmp ) ) {
      version = DEFAULT_LUCENE_MATCH_VERSION;
    }
    else {
View Full Code Here

TOP

Related Classes of org.apache.lucene.util.Version

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.