I am working with the maven-indexer componentry for the first time; please
forgive my ignorance.

I normally wouldn't ask these questions here, but there is no documentation.

Suppose I am writing an IndexCreator implementation that wants to look at
all the META-INF/MANIFEST.MF files reachable in a repository and create
fields for each header found in them.  (First off, is such dynamic field
creation even A Thing?  I am no kind of Lucene expert.)

(I'm looking to allow things like "find me artifacts that contain 'fred' in
their Class-Path manifest header" or any of a variety of other use cases
derivable from the ability to index properties-like files inside artifact
jars.)

What, in this case, should my IndexCreator return from its (undocumented)
getIndexerFields() method?  If it's called "up front", then of course I
can't return anything meaningful since I won't know the sum total of the
fields my IndexCreator will contribute until the end.  If it's not called
up front, then maybe I'm OK.  I don't actually see it being called in any
meaningful way at all, but I'm sure I'm missing something, which is why I
ask here.

Next, I noticed that IndexerField has a getVersion() method, and from
spelunking some more in the source base it seems like certain IndexCreators
effectively "bump up" this version, i.e. every time a new IndexCreator
comes up with new fields it does so with a new version.  That suggests that
perhaps I need to also get a constant added to IndexerFieldVersion, which
is an enum.  Can I just invent a version number here (I don't see this
method called anywhere in the source base) or must I use an existing one,
or…?

Lastly, I see that ArtifactInfo seems to have fields in it that correspond
loosely with the kinds of IndexCreators that exist (for example, it has a
classNames field, which to my naive eyes is filled in by the
JarFileContentsIndexCreator, suggesting that if you add a funky new
IndexCreator you are obliged to add new fields to ArtifactInfo, but that
coupling seems really wrong so I'm sure I'm missing something).  Is that
actually true?  Also, the class is marked as being "phased out", but seems
to be central to the notion of creating indices.  Is there an alternative I
should be using instead?

Thanks in advance for help with these baby steps.

Best,
Laird

Reply via email to