Lucene4 codec Reflex __lucene

Source: Internet
Author: User

The Lucene4 codec loads the corresponding class by reflection.
The information associated with reflection is placed in the Meta-inf\services directory of the Lucene jar file.
Related code in Namedspiloader.java
Some special projects need to remove the codec reflection mechanism, modify this function can be (4.5.0 version). After modification, no meta-inf\services is required.

  Public synchronized void Reload (ClassLoader ClassLoader) {final linkedhashmap<string,s> services = new Linked
    Hashmap<string,s> (this.services);
    Final spiclassiterator<s> loader = Spiclassiterator.get (Clazz, ClassLoader);
    	if (Clazz.getsimplename (). Equals ("Postingsformat")) {services.put ("Lucene40", (S) New Lucene40postingsformat ());
        
        Services.put ("Lucene41", (S) New Lucene41postingsformat ()); else if (Clazz.getsimplename (). Equals ("Docvaluesformat")) {services.put ("Lucene42", (S) New LUCENE42DOCVALUESFO
    	Rmat ());
      Services.put ("Lucene45", (S) New Lucene45docvaluesformat ());
    	else if (Clazz.getsimplename (). Equals ("Codec")) {services.put ("Lucene40", (S) New Lucene40codec ());
    	Services.put ("Lucene41", (S) New Lucene41codec ());
    	Services.put ("Lucene42", (S) New Lucene42codec ());
    	Services.put ("Lucene45", (S) New Lucene45codec ());
    Services.put ("lucene3x", (S) New Lucene3xcodec ());
   } This.services = Collections.unmodifiablemap (services); }


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.