s.grinovero wrote:
Hi,
Quote:
Is there a way to write the query like this?
+names.full_name:billy +names.deleted:false{in the same position as names.full_name:billy was found in}
Unfortunately that's not possible.
What I would to is to define a custom classbridge on the Name entity, and have it index the
Full_Name property in a
deleted_name field, or in a
name field according to the
Deleted flag.
This way you can do queries on existing names using the name field only, or enable also deleted_name field when it's ok to return them too; this would work both on queries targeting Name entities and/or Person entities.
Thank you for your response. hmmm... the only issue I can see with your recommendation (which is the second way I suggested above right?) is that it will dramatically complicate my schema. I gave a very simple example of a person and their names. But really I have a TON of these situations nesting many levels deep. I'm fully aware of the performance implications of that, but these are necessary. Even with the Name entity, in our real schema there are going to be 28 fields I need to have 2 versions of (deleted and not deleted).
So as I understand an @ClassBridge simply adds an extra field to the Lucene document for that entity. That means I'll remove all the Hibernate Search annotations on the fields for that entity and create that many @ClassBridge's times 2 (one for deleted and one for non-deleted). If there are 20 fields, I'll do something like:
Code:
@Entity
@Indexed
@ClassBridge(
name="full_name",
analyzer=@Analyzer(definition = "phonetic"),
impl=FullNameBridge.class)
@ClassBridge(
name="full_name.deleted",
...)
@ClassBridge(
name="prefix",
...)
...
... (40 total ClassBridges)
public class Name {
...
}
Suddenly Hibernate Search is starting to seem a lot less useful :(. Am I understanding your suggestion correctly?