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 Judioo <co...@judioo.com> on 2011/06/11 23:02:23 UTC

Pattern: Is there a method of resolving multivalued date ranges into a single document?

Hi All,

Question on best methods again :)

I have the following type of document.

<film>
  <title>Tron</film>
  <times>
    <time start='2010-09-23T12:00:00Z' end='2010-09-23T1430:00:00Z'
theater_id='445632'/>
    <time start='2010-09-23T15:00:00Z' end='2010-09-23T1730:00:00Z'
theater_id='445633'/>
    <time start='2010-09-23T18:00:00Z' end='2010-09-23T2030:00:00Z'
theater_id='445634'/>
  </times>
  .....
</film>

where theater identifies the place where the film is showing. Each theater
is stored in another document. I want to store the timings in the same
document as the film details. This is so I can perform a range search like

( type:film AND start:[ NOW TO * ] AND end:[NOW TO *] )

i.e. give me all the films that are scheduled to start in the future.

I was hoping I could submit a document like the following:

<doc>
  <field name="id">12345-67890-12345</field>
  <field name="title">Tron</field>
  <field name="445632_start">2010-09-23T12:00:00Z</field>
  <field name="445632_end">2010-09-23T1430:00:00Z</field>
  <field name="445633_start">2010-09-23T15:00:00Z</field>
  <field name="445633_end">2010-09-23T1730:00:00Z</field>
  <field name="445634_start">2010-09-23T18:00:00Z</field>
  <field name="445634_end">2010-09-23T2030:00:00Z</field>
  ....
</doc>


My assumption is that I could then perform a wildcard date range search like

( type:film AND *_start:[ NOW TO * ] AND *_end:[NOW TO *] )

Using the attribute name "<theater_id>_start|end"  as an indicator to the
theater. However I do not think date ranges support this.

Can ANYONE suggest a method to accomplish this with examples?


Thank you in advance.

Re: Pattern: Is there a method of resolving multivalued date ranges into a single document?

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
See
https://issues.apache.org/jira/browse/SOLR-2155?focusedCommentId=13114839&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13114839
with my response following Geert-Jan's question.

~ David

-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Pattern-Is-there-a-method-of-resolving-multivalued-date-ranges-into-a-single-document-tp3053882p3638031.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Pattern: Is there a method of resolving multivalued date ranges into a single document?

Posted by "federico.wachs" <fe...@2clams.com>.
Nobody? I don't have problem with the hours but I do have the same situation
with dates where a document could be in many date ranges.

Any suggestion? Please !

--
View this message in context: http://lucene.472066.n3.nabble.com/Pattern-Is-there-a-method-of-resolving-multivalued-date-ranges-into-a-single-document-tp3053882p3311028.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Pattern: Is there a method of resolving multivalued date ranges into a single document?

Posted by "federico.wachs" <fe...@2clams.com>.
I'm looking to implement something similar. Has anybody worked something out
to work around  this issue?

Any guidance is greatly appreciated!

Regards,
Federico

--
View this message in context: http://lucene.472066.n3.nabble.com/Pattern-Is-there-a-method-of-resolving-multivalued-date-ranges-into-a-single-document-tp3053882p3307496.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Pattern: Is there a method of resolving multivalued date ranges into a single document?

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Judioo,
 This is an interesting problem I've contemplated before. I've been working
on geospatial support for Solr using a prefix/tree/grid technique that
supports multi-valued fields. Geo/spatial might be 2D (x,y), but your
problem is 1D (time) which means you can use spatial techniques just by
ignoring one dimension.  There is a "geohash" field type as of Solr 3.1
supporting multi-valued fields but its implementation leaves much to be
desired. It might work for you, and it would certainly be a hack, but it
might be too Geo oriented, forcing you to map your times to a -180 TO +180
range. I hope to add better support for this problem to Solr by the end of
the year.

Good luck.

~ David Smiley


-----
 Author: https://www.packtpub.com/solr-1-4-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Pattern-Is-there-a-method-of-resolving-multivalued-date-ranges-into-a-single-document-tp3053882p3054714.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Pattern: Is there a method of resolving multivalued date ranges into a single document?

Posted by Michael Sokolov <so...@ifactory.com>.
Juidoo - there's no field wildcarding in Solr as your example shows.

You might want to consider building a document for each movie time that 
includes all the information you need to search on: times, movie name, 
and other details.

Otherwise you need a join operation to search across related documents, 
something you may be familiar with from relational databases that Solr 
is only just now getting some support for in new development.

-Mike

On 6/11/2011 5:02 PM, Judioo wrote:
> Hi All,
>
> Question on best methods again :)
>
> I have the following type of document.
>
> <film>
>    <title>Tron</film>
>    <times>
>      <time start='2010-09-23T12:00:00Z' end='2010-09-23T1430:00:00Z'
> theater_id='445632'/>
>      <time start='2010-09-23T15:00:00Z' end='2010-09-23T1730:00:00Z'
> theater_id='445633'/>
>      <time start='2010-09-23T18:00:00Z' end='2010-09-23T2030:00:00Z'
> theater_id='445634'/>
>    </times>
>    .....
> </film>
>
> where theater identifies the place where the film is showing. Each theater
> is stored in another document. I want to store the timings in the same
> document as the film details. This is so I can perform a range search like
>
> ( type:film AND start:[ NOW TO * ] AND end:[NOW TO *] )
>
> i.e. give me all the films that are scheduled to start in the future.
>
> I was hoping I could submit a document like the following:
>
> <doc>
>    <field name="id">12345-67890-12345</field>
>    <field name="title">Tron</field>
>    <field name="445632_start">2010-09-23T12:00:00Z</field>
>    <field name="445632_end">2010-09-23T1430:00:00Z</field>
>    <field name="445633_start">2010-09-23T15:00:00Z</field>
>    <field name="445633_end">2010-09-23T1730:00:00Z</field>
>    <field name="445634_start">2010-09-23T18:00:00Z</field>
>    <field name="445634_end">2010-09-23T2030:00:00Z</field>
>    ....
> </doc>
>
>
> My assumption is that I could then perform a wildcard date range search like
>
> ( type:film AND *_start:[ NOW TO * ] AND *_end:[NOW TO *] )
>
> Using the attribute name "<theater_id>_start|end"  as an indicator to the
> theater. However I do not think date ranges support this.
>
> Can ANYONE suggest a method to accomplish this with examples?
>
>
> Thank you in advance.
>