Hello,

I have a problem i'm trying to solve where i want to check if objects are
reserved or not. (by reservation i mean like making a reservation at a
hotel, because you would like to stay there on certain dates).

I have the following in my schema.xml

<field name="name" type="text" indexed="true" stored="true"/>
<dynamicField name="reserved_from_*" type="date" indexed="true"
stored="true"/>
<dynamicField name="reserved_to_*" type="date" indexed="true"
stored="true"/>

and the follwoing 2 documents in Solr

<doc>
<str name="name">Room1</str>
<date name="reserved_from_11">2000-08-01T00:00:00Z</date>
<date name="reserved_to_11">2000-08-31T23:59:59Z</date>
</doc>
<doc>
<str name="name">Room2</str>
<date name="reserved_from_24">2000-08-01T00:00:00Z</date>
<date name="reserved_to_24">2000-08-13T23:59:59Z</date>
<date name="reserved_from_36">2000-08-20T00:00:00Z</date>
<date name="reserved_to_36">2000-08-22T23:59:59Z</date>
</doc>

Now i want to run a query that gives me all documents(rooms) that are
avaiable from aug 15th to aug 18th (should return Room2), or from aug 10th
to aug 15th (should return none) or from sept 1st to sept 5th (should return
both).

Is it possible to run queries like this in solr? (either with my current
schema setup, or a different one that accomplishes the same idea).

I'm at a loss as to how to formulate a solr query to get the data i want.

Thanks in advance,
Constantijn Visinescu

Reply via email to