On 9/17/22 15:54, Bill Dueber wrote:
I’m writing some custom filters in java and am trying to figure out if it’s
possible to get the string output from running another fieldTypes analysis
chain.

I get an IndexSchema in the FieldType.init that I can hang onto, and
thought that maybe in my toInternal or createField I might be able to do,
essentially,

index_representation =schema.getFieldType("fieldName") .getIndexAnalyzer()
.normalize("fieldName", "text_to_normalize").

But I can’t seem to get an analyzer out of this other than the
DefaultAnalyzer, nothing specific to the fieldType I’m trying to reference.

I don’t want to give the impression I know what I’m doing — I’m more of a
cut-and-paste programmer when it comes to solr and really don’t have a good
mental model of what’s going on in there — but hope someone out there can
either tell me how to do it or laugh quietly and tell me why it can’t be
done.

It is not possible for one analysis chain to use the output of another analysis chain.  Sometimes people think that they can have one fieldType that does some analysis, and then copyField from that field to another field, where they define some additional analysis steps AFTER the ones on the first fieldType.  This is not how it works.  The copyField recipient will receive exactly the same input as the copyField source does.

If you want the kind of flexibility you are describing, you always have the option of writing your own program with the Lucene API. But you will have to write ALL of the code, including the things that Solr already does.

I have no idea how difficult it might be to accomplish your goal with a custom plugin for Solr.  I suspect, but cannot say for sure, that it might be easier to write the program using Lucene that I described above.

The easiest solution:  Just define another fieldType that does the same steps as the fieldType you want to start with, plus whatever else needs to happen after that.

Thanks,
Shawn

Reply via email to