问题
Currently I need to implement custom solr similarity. So I found out that I need to override the DefaultSimilarity class in order to do this. Still I can't figure out how exactly it should be done and where to get source code which can be used for this purpose. Any help would be appreciated!
回答1:
For anyone who will need an answer:
What I needed to do was to create a package project in eclipse, download lucene-core jar and add it to the project. After that I imported the needed library and overrided the Similarity class.
After that I created a jar with the new similarity class. Added the jar to the solr/dist/ directory. Added a ref to the jar to the solrconfig file for the needed core. Used the similarity like any other similarity in the shema file.
来源:https://stackoverflow.com/questions/45144617/implementing-custom-solr-similarity