epugh commented on code in PR #2330: URL: https://github.com/apache/solr/pull/2330#discussion_r1509997419
########## solr/solr-ref-guide/modules/indexing-guide/pages/date-formatting-math.adoc: ########## @@ -217,4 +217,117 @@ Unlike most local params, `op` is actually _not_ defined by any query parser (`f In the above example, it would find documents with indexed ranges that _contain_ (or equals) the range 2013 thru 2018. Multi-valued overlapping indexed ranges in a document are effectively coalesced. -For a DateRangeField example use-case, see https://cwiki.apache.org/confluence/display/solr/DateRangeField[Solr's community wiki]. +=== DateRangeField Example Use Case + +Suppose we want to find all restaurants that are open within a certain time window. +Let's add a date range field to the schema.xml, so that we could index the information about the restaurant opening hours: + +[source,xml] +---- +<field name="opening_hours" type="date_range" indexed="true" stored="true" multiValued="true"/> +<fieldType name="date_range" class="solr.DateRangeField"/> +---- + +Next, we will add two restaurants to the index: + +==== +[.tab-label]*JSON* +[source,json] +---- +[{ "id": "r01", + "opening_hours": [ "[2016-02-01T03:00Z TO 2016-02-01T15:00Z]", + "[2016-02-02T03:00Z TO 2016-02-02T15:00Z]", + "[2016-02-03T03:00Z TO 2016-02-03T15:00Z]", + "[2016-02-04T03:00Z TO 2016-02-04T15:00Z]", + "[2016-02-05T03:00Z TO 2016-02-05T16:00Z]", + "[2016-02-06T03:00Z TO 2016-02-06T16:00Z]", + "[2016-02-07T03:00Z TO 2016-02-07T15:00Z]" ]}, + { "id": "r02", + "opening_hours": [ "[2016-02-06T10:00Z TO 2016-02-06T12:00Z]", + "[2016-02-06T14:00Z TO 2016-02-06T16:00Z]", + "[2016-02-07T12:00Z TO 2016-02-07T16:00Z]" ]} +] +---- +==== + +Each restaurant can have multiple opening hours in a single day, +and the opening hours can be different on different days. + +NOTE: The date ranges in opening_hours should be converted to UTC before indexing. Review Comment: maybe back ticks around `opening_hours`? ########## solr/solr-ref-guide/modules/query-guide/pages/learning-to-rank.adoc: ########## @@ -811,8 +811,8 @@ Related links: * {solr-javadocs}/modules/ltr/org/apache/solr/ltr/feature/Feature.html[Feature javadocs] * {solr-javadocs}/modules/ltr/org/apache/solr/ltr/norm/Normalizer.html[Normalizer javadocs] * {solr-javadocs}/modules/ltr/org/apache/solr/ltr/interleaving/Interleaving.html[Interleaving javadocs] -* https://cwiki.apache.org/confluence/display/solr/HowToContribute -* https://cwiki.apache.org/confluence/display/LUCENE/HowToContribute +* https://github.com/apache/solr/blob/main/CONTRIBUTING.md[Contributing to Solr] Review Comment: i wasnt' sure about having these links at all, but in reading through the page, now i see, makes sense. thanks for fixing. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org