Re: query between two date

2010-10-18 Thread Savvas-Andreas Moysidis
You'll have to supply your dates in a format Solr expects (e.g.
2010-10-19T08:29:43Z
and not 2010-10-19). If you don't need millisecond granularity you can use
the DateMath syntax to specify that.

Please, also check http://wiki.apache.org/solr/SolrQuerySyntax.

On 17 October 2010 10:54, nedaha neda...@gmail.com wrote:


 Hi there,

 At first i have to explain the situation.
 I have 2 fields indexed named tdm_avail1 and tdm_avail2 that are arrays of
 some different dates.

 This is a sample doc


 arr name=tdm_avail1
 date2010-10-21T08:29:43Z/date
 date2010-10-22T08:29:43Z/date
 date2010-10-25T08:29:43Z/date
 date2010-10-26T08:29:43Z/date
 date2010-10-27T08:29:43Z/date
 /arr

 arr name=tdm_avail2
 date2010-10-19T08:29:43Z/date
 date2010-10-20T08:29:43Z/date
 date2010-10-21T08:29:43Z/date
 date2010-10-22T08:29:43Z/date
 /arr

 And in my search form i have 2 field named check-in date and check-out
 date.
 I want solr to compare the range that user enter in the search form with
 the
 values of tdm_avail1 and tdm_avail2 and return doc if all dates between
 check-in and check-out dates matches with tdm_avail1 or tdm_avail2 values.

 for example if user enter:
 check-in date: 2010-10-19
 check-out date: 2010-10-21
 that is match with tdm_avail2 then doc must be returned.

 but if user enter:
 check-in date: 2010-10-25
 check-out date: 2010-10-29
 doc could not be returned.

 so i want the query that gives me the mentioned result. could you help me
 please?

 thanks in advance

 --
 View this message in context:
 http://lucene.472066.n3.nabble.com/query-between-two-date-tp1718566p1718566.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: query between two date

2010-10-18 Thread nedaha

Thanks for your reply.
I know about the solr date format!! Check-in and Check-out dates are
user-friendly format that we use in our search form for system's users. and
i change the format via code and then send them to solr.
I want to know how can i make a query to compare a range between check-in
and check-out date with some separate different days that i have in solr
index.
for example: 
check-in date is: 2010-10-19T00:00:00Z
and
check-out date is: 2010-10-21T00:00:00Z

when i want to build a query from my application i have a range date but in
solr index i have separate dates.
So how can i compare them to get the appropriate result? 
-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/query-between-two-date-tp1718566p1723752.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: query between two date

2010-10-18 Thread Savvas-Andreas Moysidis
ok, maybe don't get this right..

are you trying to match something like check-in date  2010-10-19T00:00:00Z
AND check-out date  2010-10-21T00:00:00Z  *or* check-in date =
2010-10-19T00:00:00Z
AND check-out date = 2010-10-21T00:00:00Z?

On 18 October 2010 10:05, nedaha neda...@gmail.com wrote:


 Thanks for your reply.
 I know about the solr date format!! Check-in and Check-out dates are
 user-friendly format that we use in our search form for system's users. and
 i change the format via code and then send them to solr.
 I want to know how can i make a query to compare a range between check-in
 and check-out date with some separate different days that i have in solr
 index.
 for example:
 check-in date is: 2010-10-19T00:00:00Z
 and
 check-out date is: 2010-10-21T00:00:00Z

 when i want to build a query from my application i have a range date but in
 solr index i have separate dates.
 So how can i compare them to get the appropriate result?
 --
 View this message in context:
 http://lucene.472066.n3.nabble.com/query-between-two-date-tp1718566p1723752.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: query between two date

2010-10-18 Thread nedaha

The exact query that i want is:

check-in date = 2010-10-19T00:00:00Z 
AND check-out date = 2010-10-21T00:00:00Z

but because of the structure that i have to index i don't have specific
start date and end date in my solr index to compare with check-in and
check-out date range. I have some dates that available to reserve! 

Could you please help me? :)


-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/query-between-two-date-tp1718566p1724062.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: query between two date

2010-10-18 Thread Savvas-Andreas Moysidis
ok, I see now..well, the only query that comes to mind is something like:

check-in date:[2010-10-19T00:00:00Z TO *] AND check-out date:[* TO
2010-10-21T00:00:00Z]
would something like that work?

On 18 October 2010 11:04, nedaha neda...@gmail.com wrote:


 The exact query that i want is:

 check-in date = 2010-10-19T00:00:00Z
 AND check-out date = 2010-10-21T00:00:00Z

 but because of the structure that i have to index i don't have specific
 start date and end date in my solr index to compare with check-in and
 check-out date range. I have some dates that available to reserve!

 Could you please help me? :)


 --
 View this message in context:
 http://lucene.472066.n3.nabble.com/query-between-two-date-tp1718566p1724062.html
 Sent from the Solr - User mailing list archive at Nabble.com.



RE: query between two date

2010-10-18 Thread Jonathan Rochkind
Recommend using the pdate format for faster range queries. 

Here's how (or one way) to  do a range query in solr

defType=luceneq=some_field:[1995-12-31T23:59:59.999Z TO 2007-03-06T00:00:00Z]

Does that answer your question?  I don't really understand what you're trying 
to do with your two dates. You can of course combine range queries with 
operators with the standard/lucene query parser:

defType=luceneq=some_field:[1995-12-31T23:59:59.999Z TO 2007-03-06T00:00:00Z] 
AND other_field=[whatever TO whatever]

There are ways to make a query comparing the values of two fields too using 
function queries. But it's slighlty confusing and i'm not sure that's what you 
want to do, I'm not really sure what you want to do. Want to give an example of 
exactly what input you have (from your application), and what question you are 
trying to answer from your index?

From: nedaha [neda...@gmail.com]
Sent: Monday, October 18, 2010 5:05 AM
To: solr-user@lucene.apache.org
Subject: Re: query between two date

Thanks for your reply.
I know about the solr date format!! Check-in and Check-out dates are
user-friendly format that we use in our search form for system's users. and
i change the format via code and then send them to solr.
I want to know how can i make a query to compare a range between check-in
and check-out date with some separate different days that i have in solr
index.
for example:
check-in date is: 2010-10-19T00:00:00Z
and
check-out date is: 2010-10-21T00:00:00Z

when i want to build a query from my application i have a range date but in
solr index i have separate dates.
So how can i compare them to get the appropriate result?
--
View this message in context: 
http://lucene.472066.n3.nabble.com/query-between-two-date-tp1718566p1723752.html
Sent from the Solr - User mailing list archive at Nabble.com.


query between two date

2010-10-17 Thread nedaha

Hi there,

At first i have to explain the situation. 
I have 2 fields indexed named tdm_avail1 and tdm_avail2 that are arrays of
some different dates.

This is a sample doc


arr name=tdm_avail1
date2010-10-21T08:29:43Z/date
date2010-10-22T08:29:43Z/date
date2010-10-25T08:29:43Z/date
date2010-10-26T08:29:43Z/date
date2010-10-27T08:29:43Z/date
/arr

arr name=tdm_avail2
date2010-10-19T08:29:43Z/date
date2010-10-20T08:29:43Z/date
date2010-10-21T08:29:43Z/date
date2010-10-22T08:29:43Z/date
/arr

And in my search form i have 2 field named check-in date and check-out date.
I want solr to compare the range that user enter in the search form with the
values of tdm_avail1 and tdm_avail2 and return doc if all dates between
check-in and check-out dates matches with tdm_avail1 or tdm_avail2 values. 

for example if user enter:
check-in date: 2010-10-19
check-out date: 2010-10-21
that is match with tdm_avail2 then doc must be returned.

but if user enter:
check-in date: 2010-10-25
check-out date: 2010-10-29
doc could not be returned.

so i want the query that gives me the mentioned result. could you help me
please?

thanks in advance

-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/query-between-two-date-tp1718566p1718566.html
Sent from the Solr - User mailing list archive at Nabble.com.