#431: WebSearch: fix test case searching by date 1976-04-01 and t dog
------------------------+----------------------
  Reporter:  simko      |      Owner:  valkyrie
      Type:  defect     |     Status:  assigned
  Priority:  major      |  Milestone:  v1.0
 Component:  WebSearch  |    Version:
Resolution:             |   Keywords:
------------------------+----------------------

Comment (by simko):

 It is of secondary importance that we use dateutil on the inside and
 that it must emit valid day etc.  We should be able to treat whatever
 input values we accept from the end users so that both our internal
 procedures are happy and the overall input/output expectations are
 satisfied.

 What is of primary importance is that the test case gets the specs
 wrong.  The test case says that `find date 1976-04-01 and t dog` must
 be translated into `year:1976-04 and title:dog` which is not right.  I
 think the needs are rather such that (a) `find date YYYY-MM-DD` should
 be translated into `year:YYYY-MM-DD` for any value of `DD` (except for
 `DD==00` when it should ideally be translated into `year:YYYY-MM` as
 mentioned by Travis); (b) `find date YYYY-MM` should be translated
 into `year:YYYY-MM`; (c) `find date YYYY` should be translated into
 `year:YYYY`; etc.  The specs are obviously such that `find date xxxx`
 should accept whatever input values SPIRES currently accepts, since we
 are emulating SPIRES syntax here.

 To cover the above-mentioned cases, we don't even need to use dateutil
 internally, since the translation is direct.  Actually, when dateutil
 is not installed, the things behave just fine for this test case,
 which is why I created this ticket in the first place... IOW, the use
 of dateutil currently jumps up against the specs, which it shouldn't.

 As for technical options, I'd say let's keep using dateutil to treat
 input values where it makes sense (`yesterday - 4`) and let's not use
 it for input values where it does not make sense (`yyyy-mm-dd`, since
 directly translatable).  Also, special-casing of the form "if
 yyyy-mm-00 then bar else baz" is a simple-to-maintain and
 yet-acceptable if/then/else special-casing to me, that should not be
 worth considering moving to another library in my eyes...  Besides
 chances are that the other library may need yet another special-casing
 to satisfy yet another SPIRES date-searching compatibility feature.

-- 
Ticket URL: <https://invenio-software.org/ticket/431#comment:7>
Invenio <http://invenio-software.org>

Reply via email to