As a foolish dev (not malicious I hope!), I did mess around with something like this once; I was writing my own Codec. I found I had to create a file called META-INF/services/org.apache.lucene.codecs.Codec in my solr plugin jar that contained the fully-qualified class name of my codec: I guess this registers it with the SPI framework so it can be found by name? I'm not clear, but I think you might need to do something similar to plug in a PostingsFormat as well.

-Mike

On 01/13/2015 05:01 PM, Chris Hostetter wrote:
: This is starting to sound pretty complicated. Are you saying this is not
: doable with Solr 4.10?

it should be doable in 4.10, using a wrapper class like the one i
mentioned below (delegating to Lucene51PostingsFormat instead of
Lucene50PostingsFormat) ... it's just that the 4.10 APIs are dangerous and
let malicious/foolish java devs do scary things they shouldn't do.  but
what i outlined before (Below) is intended to work, and should continue to
work in 5.x.

: >>...or at least: that's how it *should* work :)   makes me a bit nervous
: about trying this on my own.

...worst case scenerio, i overlooked something - but all it would take to
verify that it's working is to try it at small scale: write the class,
configure it, index a handful of docs, shutdown & restart solr, and see if
your index opens & is correctly searchable -- if it is, then i didn't
overlook anything, if it isn't then there is a bug somewhere and details
of your experiement with your custom posting format (ie wrapper class)
source in JIRA would be helpful.

: Should I open a JIRA issue or am I probably the only person with a use case
: for replacing a TermIndexInterval setting with changing the min and max
: block size on the 41 postings format?

you're the only person i've ever seen ask about it :)


: > public final class MyPfWrapper extends PostingFormat {
: >   PostingFormat pf = new Lucene50PostingsFormat(42, 99999);
: >   public MyPfWrapper() {
: >     super("MyPfWrapper");
: >   }
: >   public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws
: > IOException {
: >     return pf.fieldsConsumer(state);
: >   }
: >   public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws
: > IOException {
: >     return pf.fieldsConsumer(state);
: >   }
: >   public FieldsProducer fieldsProducer(SegmentReadState state) throws
: > IOException {
: >     return pf.fieldsProducer(state);
: >   }
: > }
: >
: > ..and then refer to it with postingFormat="MyPfWrapper"


-Hoss
http://www.lucidworks.com/

Reply via email to