public class NotNullAwareIdBridge
extends java.lang.Object
implements org.hibernate.search.bridge.TwoWayFieldBridge
TwoWayFieldBridge
allows to efficiently query for associated
entities which are not null. This field bridge works the following way:
It adds the id field to the document as if it would be done without the
intervention of this class, all field attributes are preserved, additionally
this field bridge also adds a field named id.notNull
and stores
the term "true" for this field. So all associated entities which are not null
can now be queried by searching for +id.notNull:true
which is
much more efficient than using range queries.
The id.notNull
is stored with the following attributes :
Store.NO
,Index.NOT_ANALYZED
, TermVector.NO
.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NOT_NULL_FIELD_NAME |
static java.lang.String |
NOT_NULL_VALUE |
static java.lang.String |
NULL_STRING |
Constructor and Description |
---|
NotNullAwareIdBridge() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get(java.lang.String name,
org.apache.lucene.document.Document document) |
static java.lang.String |
notNullField(java.lang.String name) |
java.lang.String |
objectToString(java.lang.Object object) |
void |
set(java.lang.String name,
java.lang.Object value,
org.apache.lucene.document.Document document,
org.hibernate.search.bridge.LuceneOptions luceneOptions) |
public static final java.lang.String NOT_NULL_VALUE
public static final java.lang.String NOT_NULL_FIELD_NAME
public static java.lang.String NULL_STRING
public static java.lang.String notNullField(java.lang.String name)
name
- public void set(java.lang.String name, java.lang.Object value, org.apache.lucene.document.Document document, org.hibernate.search.bridge.LuceneOptions luceneOptions)
set
in interface org.hibernate.search.bridge.FieldBridge
public java.lang.Object get(java.lang.String name, org.apache.lucene.document.Document document)
get
in interface org.hibernate.search.bridge.TwoWayFieldBridge
public java.lang.String objectToString(java.lang.Object object)
objectToString
in interface org.hibernate.search.bridge.TwoWayFieldBridge
Copyright © 2007-2020 EDIT. All Rights Reserved.