blob: 924eaae15a65acf39e6c7db1e83337c0cd10f0b2 [file] [log] [blame]
///////////////////////////////////////////////////////////////
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
///////////////////////////////////////////////////////////////
[[extension-reindexer,Reindexer]]
= Reindexer =
[devstatus]
--------------
source=extensions/reindexer/dev-status.xml
--------------
This extension allows you to trigger a complete indexing of EntityStores into Index/Query systems.
include::../../build/docs/buildinfo/artifact.txt[]
The `Reindexer` is totally under your control and doesn't kick in automatically in any way or form.
[snippet,java]
----
source=extensions/reindexer/src/test/java/org/apache/zest/index/reindexer/ReindexerTest.java
tag=assembly
----
It will be bound to the `EntityStore` that is Visible, ask for all Entities, by calling
`entityStates()` and forward those to all `StateChangeListeners` that are Visible.
[snippet,java]
----
source=extensions/reindexer/src/test/java/org/apache/zest/index/reindexer/ReindexerTest.java
tag=usage
----
So, you call `reindex()` on the `Reindexer`. If you have many reindexers, you could call
`reindexAll()` which will locate all reindexers and call `reindex()`
on each. This is useful when there are many modules of entity stores.
There are two general issues that you need to keep in mind;
1. Not all entity stores implements `entityStates()`, mostly because the
underlying store doesn't provide a convenient mechanism to iterate
everything.
2. Unless you first clear all in the Index, deletions will not be
detected, and therefor the index might contain to many entity references in
that case.
Additionally, reindexing is not really thread safe, so need to bring the
system down while reindexing is happening.