Hi,

It is not possible in general because similarities are computing norms at
index time. (
https://github.com/apache/lucene-solr/blob/master/lucene/core/src/java/org/apache/lucene/search/similarities/Similarity.java#L46
)
My understanding is that you should double a field and set different
similarity to the new field in order to be able to change similarity for
every query. If someone has a better idea, I am also interested.


On Thu, Jul 26, 2018 at 8:51 AM Reem <reem.suwai...@gmail.com> wrote:

> Hello,
>
> Is it possible to change the ranking function (e.g., BM25Similarity,
> ClassicSimilarity, LMDirichletSimilarity, etc) in search time?
>
> The way I found to change the ranking function is by setting the
> similarity property of text fields in schema.xml as follows:
> `<similarity class="solr.LMDirichletSimilarityFactory"/>`
>
> However, this means we can only set the similarity/ranking function only
> in indexing time. As Solr is built over Lucene which allows changing the
> ranking function in search time, I find it not logical that Solr doesn’t
> support it, so it seems I’m missing something here!
>
> Any idea on how to achieve this?
>
> Reem
>

Reply via email to