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 zqzuk <zi...@hotmail.com> on 2008/03/04 17:43:14 UTC
ranged queries concerning 2 fields, each are multivalued
Hi all, in my application I need to index some seminar data. The basic
assumption is that each seminar can be allocated to multiple time slots,
with an start time and an end time. For example on 1st March it is allocated
to 14:00 to 16:00 ; then on 1st April it is reallocated to 10:00 - 11:30.
The typical ranged query I want to do is "find if there are any seminars
happening at 12.00, i.e., start time<12.00< end time"
I have these following lines in my schema:
<field name="start" type="sfloat" indexed="true" stored="true"
multiValued="true"/>
<field name="end" type="sfloat" indexed="true" stored="true"
multiValued="true"/>
And example data Seminar ID=1, start:10.0 hr end 11.5 hr; and start: 14.0 hr
and end 16.0 hr.
<field name="start">10.0</field>
<field name="end">11.5</field>
<field name="start">14.0</field>
<field name="end">16.0</field>
however this does not work for the query " start<12.0<end" - it finds the
example data above, which is incorrect. This is because the "start" value
is not "glued" to the specific "end" value.
Is there anyway to achieve this? by schema, or data... sorry about the odd
example but we do need to model our data in such way in our application.
Many thanks in advance!
--
View this message in context: http://www.nabble.com/ranged-queries-concerning-2-fields%2C-each-are-multivalued-tp15831403p15831403.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: ranged queries concerning 2 fields, each are multivalued
Posted by Chris Hostetter <ho...@fucit.org>.
here is no way out of the box to achieve what you are asking for with the
schema as you have it setup. possible ways of implementing something like
this have been discussed on the mailing list in the past, but it would
require some extensive java coding.
one key option to consider is to rethink how you structure your documents
... you currently have one document per seminar, perhaps instead (or
inadditio) you should have one document her seminar instance.
you can still have a document per seminar containing all of the times that
seinar is held, and filter on these types of documents for the
purposes of generic searchinglisting/faceting of data that isn't instance
specific -- but when doing the time based restrictions you describe, you
could switch to a differnet document type where each instance has it's own
document, and the start/end fields are single value.
: however this does not work for the query " start<12.0<end" - it finds the
: example data above, which is incorrect. This is because the "start" value
: is not "glued" to the specific "end" value.
:
: Is there anyway to achieve this? by schema, or data... sorry about the odd
: example but we do need to model our data in such way in our application.
-Hoss