In Solr you need a CodecFactory to deliver a Codec that happens to use your PostingFormat. The CodecFactory can set any params you like.
On Fri, Mar 13, 2015 at 12:13 PM, Tom Burton-West <[email protected]> wrote: > Thanks Uwe, > > I'm pretty much going from what Hoss told me in the thread > here::http://lucene.472066.n3.nabble.com/How-to-configure-Solr-PostingsFormat-block-size-tt4179029.html > > All I am really trying to do is instantiate the regular > Lucene41PostingsFormat with non-default minTermBlockSize and > maxTermBlockSize parameters. However, that apparently can't be done in > schema.xml. So Hoss suggested a wrapper class around PostingsFormat that > instantiates the Lucene41PostingsFormat with the desired parameters: > > "where does that leave you as a solr user who wants to write a plugin, since > Solr only allows you to configure the SPI name (no constructor args) via > 'postingFormat="foo"' the anwser is that instead of writing a subclass, you > would have to write a small proxy class, something like... > > public final class MyPfWrapper extends PostingFormat { > PostingFormat pf = new Lucene50PostingsFormat(42, 99999); > public MyPfWrapper() { > super("MyPfWrapper"); > } > .... > rest of code skipped. > > I don't really understand SPI and class loaders, but you are right this > class is a subclass of PostingsFormat not Codecs. So is there an issue > with the whole idea, or is there just some subtlety of class loading and the > SPILoader I'm not understanding? > > Tom > > > > > > > On Fri, Mar 13, 2015 at 11:35 AM, Uwe Schindler <[email protected]> wrote: >> >> Hi, >> >> >> >> To me this looks like the implementing class is not a real subclass of >> org.apache.lucene.codecs.Codec – because you said “PostingsFormat” not >> “Codec” in your mail? If you just want to create your own PostingsFormat, >> you have to put it into the other META-INF file for >> org.apache.lucene.codecs.PostingsFormats. Creating own codecs is in most >> cases not needed, most people are only interested in postings formats. >> >> >> >> Another reason for this could be that the JAR file with the codec is in a >> different classloader than the one of lucene-core.jar. >> >> >> >> Uwe >> >> >> >> ----- >> >> Uwe Schindler >> >> H.-H.-Meier-Allee 63, D-28213 Bremen >> >> http://www.thetaphi.de >> >> eMail: [email protected] >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
