Hello,
Is there any way to filter elements of children collection during indexing ?
Example :
Code:
@Index
class Parent {
@IndexedEmbedded
Set<Child> children;
}
class Child {
/* A lot of properties */
}
When I create or update a Parent instance I want to index only some children elements.
The only working way I found for now is to use @ClassBridge. I give the code because it may interests some others people but I just can't use this solution because my Child class already have a lot of indexed properties (annoted with @Field, multi times for some of them with different analysers) and it works fine (except that now I want to filter some of them) and I don't want to write the whole equivalent code in a lot of Brigde classes (1 brigde / per collection / per analyser).
Code:
@ClassBridge(impl = ChildBridge.class, analyzer=@Analyzer(definition = "some_analyser_name"))
class Child {
/* A lot of properties */
}
class ChildBridge {
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
Child child = (Child) value;
if (skipIndex(child)) {
return;
}else{
//manually index each property
}
}
private boolean skipIndex(Child child) {
/* some conditions */
}
}
Please forgive me for my mistakes, I am a french guy with a poor english :)