You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Zheng Lin Edwin Yeo <ed...@gmail.com> on 2015/05/27 10:22:59 UTC

Displaying a date field that is empty

Hi,

Would like to check, is there any method to index date that are empty, and
allow it to be searchable and be displayed as an empty field?

Currently, for my csv records, there's some records which has no date in
the date field, while others have. For those records with no dates, when I
search for these records, the date field is not return. I'll like to have
the date field to be return regardless if there's any date in it. The type
of the field is set to type="tdate".

Is this possible to be done?


Regards,
Edwin

Re: Displaying a date field that is empty

Posted by Alessandro Benedetti <be...@gmail.com>.
Mmmm if you add a default value, you are going to index a "fake" date for
the null one ( like a specific date you decide).
Of course this default value should be different from any other possible
date in your system and must not be misleading for users.

The reason you want the date to be in the document object even if null is
because I assume you simply show all the fields coming from the Solr
Document.

Of course it depends on the use case if you prefer to have a null field
shown or not.
Be only sure the "fake" special date you use, will be not in the real dates
and would be easily matchable to show in the UI, that there is no date for
that document.

Cheers

2015-05-27 9:40 GMT+01:00 Ahmet Arslan <io...@yahoo.com.invalid>:

> Hi,
>
> One approach if to use default value for that field. Missing values
> represented by that constant value.
>
> Other approach is to use a query to capture documents that do not have
> that field:
> +*:* -field:[* TO *]
> I think, newly added exists(field) function query can be used too.
>
> Ahmet
>
>
>
> On Wednesday, May 27, 2015 11:23 AM, Zheng Lin Edwin Yeo <
> edwinyeozl@gmail.com> wrote:
> Hi,
>
> Would like to check, is there any method to index date that are empty, and
> allow it to be searchable and be displayed as an empty field?
>
> Currently, for my csv records, there's some records which has no date in
> the date field, while others have. For those records with no dates, when I
> search for these records, the date field is not return. I'll like to have
> the date field to be return regardless if there's any date in it. The type
> of the field is set to type="tdate".
>
> Is this possible to be done?
>
>
> Regards,
> Edwin
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Displaying a date field that is empty

Posted by Ahmet Arslan <io...@yahoo.com.INVALID>.
Hi,

One approach if to use default value for that field. Missing values represented by that constant value.

Other approach is to use a query to capture documents that do not have that field: 
+*:* -field:[* TO *]
I think, newly added exists(field) function query can be used too.

Ahmet



On Wednesday, May 27, 2015 11:23 AM, Zheng Lin Edwin Yeo <ed...@gmail.com> wrote:
Hi,

Would like to check, is there any method to index date that are empty, and
allow it to be searchable and be displayed as an empty field?

Currently, for my csv records, there's some records which has no date in
the date field, while others have. For those records with no dates, when I
search for these records, the date field is not return. I'll like to have
the date field to be return regardless if there's any date in it. The type
of the field is set to type="tdate".

Is this possible to be done?


Regards,
Edwin