Hi Iram, following up on Mikhail's answer: 1) K Nearest Neighbour is a retrieval approach intended to look for the closest(approximate) K vectors to a query one. "override the existing function or write a custom method to give a high score to the latest documents" It seems suspicious to me. It's like you want to combine two features for the final score:
- Vector Similarity - Recency As you can imagine a first question arises: How do you want to combine these features? Linearly? Non linearly? Do you want to re-score the top-k calculating this recency? Learning To Rank ( https://solr.apache.org/guide/solr/latest/query-guide/learning-to-rank.html) or general reranking( https://solr.apache.org/guide/solr/latest/query-guide/query-re-ranking.html) could be what you want. Please make sure you are familiar with function queries as well ( https://solr.apache.org/guide/solr/latest/query-guide/function-queries.html) 2) The pull request mentioned by Mikhail is on the spot, but it has not been ported to Apache Solr yet. Technically, it is going to be useful, but from a pragmatic perspective, I am much more sceptical: With current models, finding a threshold won't be easy at all. Cheers -------------------------- *Alessandro Benedetti* Director @ Sease Ltd. *Apache Lucene/Solr Committer* *Apache Solr PMC Member* e-mail: a.benede...@sease.io *Sease* - Information Retrieval Applied Consulting | Training | Open Source Website: Sease.io <http://sease.io/> LinkedIn <https://linkedin.com/company/sease-ltd> | Twitter <https://twitter.com/seaseltd> | Youtube <https://www.youtube.com/channel/UCDx86ZKLYNpI3gzMercM7BQ> | Github <https://github.com/seaseltd> On Mon, 25 Dec 2023 at 22:55, Iram Tariq <iram.ta...@northbaysolutions.net> wrote: > Hi All, > > Right now I am using the cosine similarity function for dense vectors. > Is there any way I can override the existing function or write a > custom method to give a high score to the latest documents. > > > Also KNN Query Parser returns topK results matched with the input, but is > there anyway possible we can get all documents for which similarity score > is greater than a specific number? > > Any sort of answer will be helpful. Looking forward for the feedback. > > Regards, > > > Iram Tariq | Software Architect > > NorthBay > > Direct: +1 (902) 329-7329 > > iram.ta...@northbaysolutions.net > > www.northbaysolutions.com >