Have to say, Lucene source code in most places are left with comments, explained in detail, reading will be very convenient
Defining analyzers
New StandardAnalyzer (version.lucene_47);
Take StandardAnalyzer as an example, only the version number of Stopword and Lucene is loaded
Indexwriterconfig initialization, loading the configuration required to build the index
New Indexwriterconfig (version.lucene_47, analyzer);
Indexwriterconfig Inheritance Liveindexwriterconfig
//used by IndexwriterconfigLiveindexwriterconfig (Analyzer Analyzer, Version matchversion) { This. Analyzer = Analyzer;//load a word breaker This. matchversion = matchversion;//Lucene versionRambuffersizemb = INDEXWRITERCONFIG.DEFAULT_RAM_BUFFER_SIZE_MB;//when this value is reached in memory, the flush data is started to the hard disk, the default 16MMaxbuffereddocs = Indexwriterconfig.default_max_buffered_docs;//This value is Disable_auto_flush with Maxbuffereddeleteterms and the default value is-1, auto flush is stopped, that is, the memory is not allowed to store both valuesMaxbuffereddeleteterms = indexwriterconfig.default_max_buffered_delete_terms;//Ibid .Readertermsindexdivisor = Indexwriterconfig.default_reader_terms_index_divisor;//The default is 1, which reads the divisor of the term fileMergedsegmentwarmer =NULL;//Lucene gives explanations warm is called before any deletes has been carried over the merged segment | Warm was called before any delete operation, and was deferred until the merge was completed. /c4>Termindexinterval = Indexwriterconfig.default_term_index_interval;//Todo:this should is private to the codec, not settable here//default Jump table spacingDelpolicy =NewKeeponlylastcommitdeletionpolicy ();//for the policy of the index commit deletion, implement Indexdeletionpolicy, note that the policy will only save the most recent commit, if a commit operation is complete, directly deletecommit =NULL; Usecompoundfile= Indexwriterconfig.default_use_compound_file_system;//whether to use a composite index, which is true by defaultOpenMode = Openmode.create_or_append;//open mode for creating and appendingSimilarity = Indexsearcher.getdefaultsimilarity ();//set the default scoring policy, VSMMergescheduler =NewConcurrentmergescheduler ();//Segment Merge Scheduler, concurrent thread safetyWritelocktimeout = Indexwriterconfig.write_lock_timeout;//Write lock TimeoutIndexingchain = Documentswriterperthread.defaultindexingchain;//Index Chaincodec = Codec.getdefault ();//Lucene Index file header (magic,codecname,version) checksum, according to Lucene version, default is the current version if(codec = =NULL) { Throw NewNullPointerException (); } Infostream= Infostream.getdefault ();//default NooutputMergepolicy =NewTieredmergepolicy ();//Segment Merge PolicyFlushpolicy =NewFlushbyramorcountspolicy ();//Flush Policyreaderpooling = indexwriterconfig.default_reader_pooling;//Reader pool is not used by defaultIndexerthreadpool =NewThreadaffinitydocumentswriterthreadpool (indexwriterconfig.default_max_thread_states);//The maximum number of threads allowed to index operations on the same indexwriter, default is 8PERTHREADHARDLIMITMB = INDEXWRITERCONFIG.DEFAULT_RAM_PER_THREAD_HARD_LIMIT_MB;//default 1945, each thread allocates the maximum capacity in memory}
Each of these strategies waits for the actual call to be analyzed.
Index establishment process of lucene4.7 source Research (2)