You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Piotr Tajduś <pi...@skg.pl> on 2019/11/18 13:11:33 UTC
Removing mixin type doesn't remove document from lucene index based
on this type
I have lucene index with rule pointing to mixin type. After 30 days
documents loose this mixin type, however they are not removed from
index. It looks like a bug to me. It doesn't cause direct problems, as
mixin type is checked during query, but when I try to find some oldest
documents, hundreds of thousands documents are index traversed until
valid documents are found.
Best regards,
Piotr
Re: Removing mixin type doesn't remove document from lucene index
based on this type
Posted by Piotr Tajduś <pi...@skg.pl>.
The same situation is with adding mixin type to existing document. I
have fixed it by marking document as dirty when indexing rule exists for
one state and doesn't exist for another:
Index: LuceneIndexEditor.java
===================================================================
--- LuceneIndexEditor.java (wersja 26)
+++ LuceneIndexEditor.java (kopia robocza)
@@ -134,6 +134,21 @@
NodeState current = after.exists() ? after : before;
indexingRule =
getDefinition().getApplicableIndexingRule(current);
+ if(after.exists() && before.exists()) {
+ IndexDefinition.IndexingRule afterIndexingRule =
getDefinition().getApplicableIndexingRule(after);
+ IndexDefinition.IndexingRule beforeIndexingRule =
getDefinition().getApplicableIndexingRule(before);
+ if((afterIndexingRule!=null)^(beforeIndexingRule!=null)) {
+ markDirty();
+ if(indexingRule==null) {
+ if(beforeIndexingRule!=null) {
+ indexingRule=beforeIndexingRule;
+ } else {
+ indexingRule=afterIndexingRule;
+ }
+ }
+ }
+ }
+
if (indexingRule != null) {
currentMatchers =
indexingRule.getAggregate().createMatchers(this);
}
On 18.11.2019 14:11, Piotr Tajduś wrote:
> I have lucene index with rule pointing to mixin type. After 30 days
> documents loose this mixin type, however they are not removed from
> index. It looks like a bug to me. It doesn't cause direct problems, as
> mixin type is checked during query, but when I try to find some oldest
> documents, hundreds of thousands documents are index traversed until
> valid documents are found.
>
>
> Best regards,
>
> Piotr