[hibernate-dev] [HSEARCH-670] Add indexNullAs to @IndexedEmbedded

Davide D'Alto daltodavide at gmail.com
Fri Aug 12 07:35:39 EDT 2011


Maybe we can add an option like "boolean emptyAsNull" to IndexEmbedded.

On Fri, Aug 12, 2011 at 12:31 PM, Davide D'Alto <daltodavide at gmail.com> wrote:
> I've first written a simple test and then I chose the parameters
> accordingly so that the test can pass.
> Before investingate further I wanted to ask if there are already some
> defaults to use in this case.
>
> An empty collection is not a null so my patch shouldn't change the
> existing behaviour.
> I need to check but I think nothing is indexed in that case.
>
> On Fri, Aug 12, 2011 at 12:09 PM, Sanne Grinovero <sanne at hibernate.org> wrote:
>> Hi Davide,
>> as Index option I would use Index.NOT_ANALYZED_NO_NORMS; ANALYZED is
>> not a proper fit as it might break the marker token in pieces and get
>> some unpredictable behaviour.
>>
>> About Store .. do you need to store it? I assume you do to mark the
>> difference between a null collection and an empty collection, but
>> there might be ways around that, in fact we only want to know if this
>> document matches a Term (fieldName, nullToken), and you don't need to
>> store it for that.
>>
>> I wouldn't disagree in using Store.YES if there are good reasons
>> though; could you explain how this is working?
>>
>> Cheers,
>> Sanne
>>
>>
>> 2011/8/12 Davide D'Alto <daltodavide at gmail.com>:
>>> Hello,
>>> I've created a prototype for HSEARCH-670:
>>> https://github.com/DavideD/hibernate-search/commits/HSEARCH-670
>>>
>>> It seems to work but I'm not sure about the options to use indexing
>>> the null value.
>>> At the moment it uses the following LucenOption object:
>>>
>>> LuceneOptions options = new LuceneOptionsImpl(
>>>                                        Store.YES,
>>>                                        org.apache.lucene.document.Field.Index.ANALYZED,
>>>                                        org.apache.lucene.document.Field.TermVector.NO,
>>>                                        1F );
>>>
>>> And I use the following default TwoWayStringBridge:
>>>
>>> TwoWayStringBridge fb = new TwoWayStringBridge() {
>>>
>>>                                @Override
>>>                                public String objectToString(Object object) {
>>>                                        return nullMarker;
>>>                                }
>>>
>>>                                @Override
>>>                                public Object stringToObject(String stringValue) {
>>>                                        return null;
>>>                                }
>>>                        };
>>>
>>> This is the method:
>>> https://github.com/DavideD/hibernate-search/commit/52a9280321e6ea06ff8324275ac7e0db55dab16b#L2R576
>>>
>>> Do they make sense?
>>>
>>> Cheers,
>>> Davide
>>> _______________________________________________
>>> hibernate-dev mailing list
>>> hibernate-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>
>>
>




More information about the hibernate-dev mailing list