From 79e8b695f6728f4ae96f8a0d6925190a9ec0b502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Krch?= Date: Tue, 29 Aug 2023 22:41:18 +0200 Subject: [PATCH] documentation - details on how to use/implement document decay feature --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index fcc94d5..adc7467 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,17 @@ dotnet add package Kentico.Xperience.Lucene - Read the Lucene.NET [introduction](https://lucenenet.apache.org/) or [full documentation](https://lucenenet.apache.org/docs/4.8.0-beta00016/) to explore the core library's APIs and functionality. - Explore the [Lucene.NET source on GitHub](https://github.com/apache/lucenenet) +### Implementing document decay feature (scoring by "freshness", "recency") + +1) boosting relevant fields by setting field boost (preferable method, but requires more work) +2) boosting one field with constant value, that is always present in search query (shown in sample, less desirable method. Downside of this method is that all documents get matched, usable only for scenarios where total number of result is not required) +3) using sort expression, implementation details can be found in Lucene.NET unit tests, Lucene.NET implementations + +Methods 1 and 2 require implementing `DefaultLuceneIndexingStrategy` and overriding `OnDocumentAddField` method. +In `OnDocumentAddField` match required fields and calculate boost, then apply to desired files as shown in example `DancingGoatLuceneIndexingStrategy.OnDocumentAddField` + +> differences too small in boosts will be ignored by Lucene + ## Sample features ### Trigger rebuild of index via webhook