RE: Hotel Searches

2013-01-09 Thread Harshvardhan Ojha
Hi Uwe,

Thanks for your reply. I think this will solve my problem.

Regards
Harshvardhan Ojha

-Original Message-
From: Uwe Reh [mailto:r...@hebis.uni-frankfurt.de] 
Sent: Wednesday, January 09, 2013 2:52 PM
To: solr-user@lucene.apache.org
Subject: Re: Hotel Searches

Hi,

maybe I'm thinking too simple again. Nevertheless, here an idea to solve the 
question. The basic thought is to get rid of the range query.

Have:
- a textfield 'vacant_days'. Instead of ISO-Dates just simple dates in the form 
mmdd
- a dynamic field 'price_*', You can add the tariff for Jan. 31th into 
'price_0131'

To get the total,  eg. Feb. 1st to Feb. 3th you could query for the days 0201, 
0202 and 0203. You can calculate the sum of the corresponding price fields
> q=vacant_days:0201 AND vacant_days:0202 AND 
> vacant_days:0203&fl?_val_:"sum(price_0201, price_0202, price_0203)"
(not tested)

Uwe


Am 09.01.2013 07:08, schrieb Harshvardhan Ojha:
> Hi Alex,
>
> Thanks for your reply.
> I saw "prices based on daterange using multipoints ". But this is not my 
> problem. Instead the problem statement for me is pretty simple.
>
> Say I have 100 documents each having tariff as field.
> Doc1
> 
> 2400.0
> 
>
> Doc2
> 
> 2500.0
> 
>
> Now a user's search should give me a total tariff.
>
> Desired result
> 
> 4900.0
> 
>
> And this could be any combination for 100 docs it is (100+101)/2. (N*N+1)/2.
>
> How can I get these combination of documents already indexed ?
> Or is there any way to do calculations at runtime?
>
> How can I place this constraint that if there is any 1 doc missing in a range 
> don’t give me any result.(if a user asked for hotel tariff from 11th to 13th, 
> and I don’t have tariff for 12th, I shouldn't add 11th and 13th only).
>
> Hope I made my problem very simple.
>
> Regards
> Harshvardhan Ojha
>
> -Original Message-
> From: Alexandre Rafalovitch [mailto:arafa...@gmail.com]
> Sent: Tuesday, January 08, 2013 6:12 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Hotel Searches
>
> Did you look at a conversation thread from 12 Dec 2012 on this list? Just go 
> to the archives and search for 'hotel'. Hopefully that will give you 
> something to work with.
>
> If you have any questions after that, come back with more specifics.
>
> Regards,
> Alex.
>
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all 
> at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD 
> book)
>
>
> On Tue, Jan 8, 2013 at 7:18 AM, Harshvardhan Ojha < 
> harshvardhan.o...@makemytrip.com> wrote:
>
>> Sorry for that, we just spoiled that thread so posted my question in 
>> a fresh thread.
>>
>> Problem is indeed very simple.
>> I have solr documents, which has all the required fields(from db).
>> Say DOC1,DOC2,DOC3.DOCn.
>>
>> Every document has 1 night tariff and I have 180 nights tariff.
>> So a person can search for any combination in these 180 nights.
>>
>> Say a request came to me to give total tariff for 10th to 15th of jan 2013.
>> Now I need to get a sum of tariff field of 6 docs.
>>
>> So how can I keep this data indexed, to avoid search time 
>> calculation, and there are other dimensions of this data also beside tariff.
>> Hope this makes sense.
>>
>> Regards
>> Harshvardhan Ojha
>>
>> -Original Message-
>> From: Gora Mohanty [mailto:g...@mimirtech.com]
>> Sent: Tuesday, January 08, 2013 5:37 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Hotel Searches
>>
>> On 8 January 2013 17:10, Harshvardhan Ojha < 
>> harshvardhan.o...@makemytrip.com> wrote:
>>> Hi All,
>>>
>>> Looking into a finding solution for Hotel searches based on the 
>>> below criteria's
>> [...]
>>
>> Didn't you just post this on a separate thread, complete with some 
>> nonsensical follow-up from a colleague of yours? Please do not repost 
>> the same message over and over again.
>>
>> It is not clear what you are trying to achieve.
>> What is the difference between a city and a hotel in your data? How 
>> is a person represented in your documents? Is it by the ID field?
>>
>> Are you looking to cache all possible combinations of ID, city, and 
>> startdate? If so, to what end?  This smells like a XY problem:
>> http://people.apache.org/~hossman/#xyproblem
>>
>> Regards,
>> Gora
>>



Re: Hotel Searches

2013-01-09 Thread Uwe Reh

Hi,

maybe I'm thinking too simple again. Nevertheless, here an idea to solve 
the question. The basic thought is to get rid of the range query.


Have:
- a textfield 'vacant_days'. Instead of ISO-Dates just simple dates in 
the form mmdd
- a dynamic field 'price_*', You can add the tariff for Jan. 31th into 
'price_0131'


To get the total,  eg. Feb. 1st to Feb. 3th you could query for the days 
0201, 0202 and 0203. You can calculate the sum of the corresponding 
price fields

q=vacant_days:0201 AND vacant_days:0202 AND 
vacant_days:0203&fl?_val_:"sum(price_0201, price_0202, price_0203)"

(not tested)

Uwe


Am 09.01.2013 07:08, schrieb Harshvardhan Ojha:

Hi Alex,

Thanks for your reply.
I saw "prices based on daterange using multipoints ". But this is not my 
problem. Instead the problem statement for me is pretty simple.

Say I have 100 documents each having tariff as field.
Doc1

2400.0


Doc2

2500.0


Now a user's search should give me a total tariff.

Desired result

4900.0


And this could be any combination for 100 docs it is (100+101)/2. (N*N+1)/2.

How can I get these combination of documents already indexed ?
Or is there any way to do calculations at runtime?

How can I place this constraint that if there is any 1 doc missing in a range 
don’t give me any result.(if a user asked for hotel tariff from 11th to 13th, 
and I don’t have tariff for 12th, I shouldn't add 11th and 13th only).

Hope I made my problem very simple.

Regards
Harshvardhan Ojha

-Original Message-
From: Alexandre Rafalovitch [mailto:arafa...@gmail.com]
Sent: Tuesday, January 08, 2013 6:12 PM
To: solr-user@lucene.apache.org
Subject: Re: Hotel Searches

Did you look at a conversation thread from 12 Dec 2012 on this list? Just go to 
the archives and search for 'hotel'. Hopefully that will give you something to 
work with.

If you have any questions after that, come back with more specifics.

Regards,
Alex.

Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at once. 
Lately, it doesn't seem to be working.  (Anonymous  - via GTD book)


On Tue, Jan 8, 2013 at 7:18 AM, Harshvardhan Ojha < 
harshvardhan.o...@makemytrip.com> wrote:


Sorry for that, we just spoiled that thread so posted my question in a
fresh thread.

Problem is indeed very simple.
I have solr documents, which has all the required fields(from db).
Say DOC1,DOC2,DOC3.DOCn.

Every document has 1 night tariff and I have 180 nights tariff.
So a person can search for any combination in these 180 nights.

Say a request came to me to give total tariff for 10th to 15th of jan 2013.
Now I need to get a sum of tariff field of 6 docs.

So how can I keep this data indexed, to avoid search time calculation,
and there are other dimensions of this data also beside tariff.
Hope this makes sense.

Regards
Harshvardhan Ojha

-Original Message-
From: Gora Mohanty [mailto:g...@mimirtech.com]
Sent: Tuesday, January 08, 2013 5:37 PM
To: solr-user@lucene.apache.org
Subject: Re: Hotel Searches

On 8 January 2013 17:10, Harshvardhan Ojha <
harshvardhan.o...@makemytrip.com> wrote:

Hi All,

Looking into a finding solution for Hotel searches based on the
below criteria's

[...]

Didn't you just post this on a separate thread, complete with some
nonsensical follow-up from a colleague of yours? Please do not repost
the same message over and over again.

It is not clear what you are trying to achieve.
What is the difference between a city and a hotel in your data? How is
a person represented in your documents? Is it by the ID field?

Are you looking to cache all possible combinations of ID, city, and
startdate? If so, to what end?  This smells like a XY problem:
http://people.apache.org/~hossman/#xyproblem

Regards,
Gora





Re: Hotel Searches

2013-01-09 Thread Upayavira
It seems to me like you want to use result grouping by hotel. You'll
have to add up the tariffs for each hotel, but that isn't hard.

Upayavira

On Wed, Jan 9, 2013, at 06:08 AM, Harshvardhan Ojha wrote:
> Hi Alex,
> 
> Thanks for your reply.
> I saw "prices based on daterange using multipoints ". But this is not my
> problem. Instead the problem statement for me is pretty simple.
> 
> Say I have 100 documents each having tariff as field.
> Doc1
> 
> 2400.0
> 
> 
> Doc2
> 
> 2500.0
> 
> 
> Now a user's search should give me a total tariff.
> 
> Desired result
> 
> 4900.0
> 
> 
> And this could be any combination for 100 docs it is (100+101)/2.
> (N*N+1)/2.
> 
> How can I get these combination of documents already indexed ?
> Or is there any way to do calculations at runtime?
> 
> How can I place this constraint that if there is any 1 doc missing in a
> range don’t give me any result.(if a user asked for hotel tariff from
> 11th to 13th, and I don’t have tariff for 12th, I shouldn't add 11th and
> 13th only).
> 
> Hope I made my problem very simple.
> 
> Regards
> Harshvardhan Ojha
> 
> -Original Message-----
> From: Alexandre Rafalovitch [mailto:arafa...@gmail.com] 
> Sent: Tuesday, January 08, 2013 6:12 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Hotel Searches
> 
> Did you look at a conversation thread from 12 Dec 2012 on this list? Just
> go to the archives and search for 'hotel'. Hopefully that will give you
> something to work with.
> 
> If you have any questions after that, come back with more specifics.
> 
> Regards,
>Alex.
> 
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all at
> once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD book)
> 
> 
> On Tue, Jan 8, 2013 at 7:18 AM, Harshvardhan Ojha <
> harshvardhan.o...@makemytrip.com> wrote:
> 
> > Sorry for that, we just spoiled that thread so posted my question in a 
> > fresh thread.
> >
> > Problem is indeed very simple.
> > I have solr documents, which has all the required fields(from db).
> > Say DOC1,DOC2,DOC3.DOCn.
> >
> > Every document has 1 night tariff and I have 180 nights tariff.
> > So a person can search for any combination in these 180 nights.
> >
> > Say a request came to me to give total tariff for 10th to 15th of jan 2013.
> > Now I need to get a sum of tariff field of 6 docs.
> >
> > So how can I keep this data indexed, to avoid search time calculation, 
> > and there are other dimensions of this data also beside tariff.
> > Hope this makes sense.
> >
> > Regards
> > Harshvardhan Ojha
> >
> > -Original Message-
> > From: Gora Mohanty [mailto:g...@mimirtech.com]
> > Sent: Tuesday, January 08, 2013 5:37 PM
> > To: solr-user@lucene.apache.org
> > Subject: Re: Hotel Searches
> >
> > On 8 January 2013 17:10, Harshvardhan Ojha < 
> > harshvardhan.o...@makemytrip.com> wrote:
> > > Hi All,
> > >
> > > Looking into a finding solution for Hotel searches based on the 
> > > below criteria's
> > [...]
> >
> > Didn't you just post this on a separate thread, complete with some 
> > nonsensical follow-up from a colleague of yours? Please do not repost 
> > the same message over and over again.
> >
> > It is not clear what you are trying to achieve.
> > What is the difference between a city and a hotel in your data? How is 
> > a person represented in your documents? Is it by the ID field?
> >
> > Are you looking to cache all possible combinations of ID, city, and 
> > startdate? If so, to what end?  This smells like a XY problem:
> > http://people.apache.org/~hossman/#xyproblem
> >
> > Regards,
> > Gora
> >


Re: Hotel Searches

2013-01-08 Thread Gora Mohanty
On 8 January 2013 17:48, Harshvardhan Ojha
 wrote:
> Sorry for that, we just spoiled that thread so posted my question in a fresh 
> thread.
>
> Problem is indeed very simple.
> I have solr documents, which has all the required fields(from db).
> Say DOC1,DOC2,DOC3.DOCn.
>
> Every document has 1 night tariff and I have 180 nights tariff.
> So a person can search for any combination in these 180 nights.
>
> Say a request came to me to give total tariff for 10th to 15th of jan 2013.
> Now I need to get a sum of tariff field of 6 docs.
>
> So how can I keep this data indexed, to avoid search time calculation, and 
> there are other dimensions of this data also beside tariff.
[...]

I think that you might be making this more complex
than it needs to be. To start with, have you tested
the response time for a search, plus adding the tariffs
for the returned results, to see if this meets your needs?

It is not feasible to pre-calculate, and cache the results
of all possible combinations of 1,2,3,...180 nights from
a set of 180 nights. And, that would be just one hotel.
What if the user wanted to search for a date range on
a chosen set of hotels?

I would suggest starting by defining the full extent of
what you need, and to decide on acceptable response
times which would be driven by business imperatives.
You might need to compromise on some things to make
this feasible. E.g., if rather than having separate tariffs
for each day, you could do with daily, weekly, monthly,
etc., rates.

Regards,
Gora


RE: Hotel Searches

2013-01-08 Thread Harshvardhan Ojha
Hi Alex,

Thanks for your reply.
I saw "prices based on daterange using multipoints ". But this is not my 
problem. Instead the problem statement for me is pretty simple.

Say I have 100 documents each having tariff as field.
Doc1

2400.0


Doc2

2500.0


Now a user's search should give me a total tariff.

Desired result

4900.0


And this could be any combination for 100 docs it is (100+101)/2. (N*N+1)/2.

How can I get these combination of documents already indexed ?
Or is there any way to do calculations at runtime?

How can I place this constraint that if there is any 1 doc missing in a range 
don’t give me any result.(if a user asked for hotel tariff from 11th to 13th, 
and I don’t have tariff for 12th, I shouldn't add 11th and 13th only).

Hope I made my problem very simple.

Regards
Harshvardhan Ojha

-Original Message-
From: Alexandre Rafalovitch [mailto:arafa...@gmail.com] 
Sent: Tuesday, January 08, 2013 6:12 PM
To: solr-user@lucene.apache.org
Subject: Re: Hotel Searches

Did you look at a conversation thread from 12 Dec 2012 on this list? Just go to 
the archives and search for 'hotel'. Hopefully that will give you something to 
work with.

If you have any questions after that, come back with more specifics.

Regards,
   Alex.

Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at once. 
Lately, it doesn't seem to be working.  (Anonymous  - via GTD book)


On Tue, Jan 8, 2013 at 7:18 AM, Harshvardhan Ojha < 
harshvardhan.o...@makemytrip.com> wrote:

> Sorry for that, we just spoiled that thread so posted my question in a 
> fresh thread.
>
> Problem is indeed very simple.
> I have solr documents, which has all the required fields(from db).
> Say DOC1,DOC2,DOC3.DOCn.
>
> Every document has 1 night tariff and I have 180 nights tariff.
> So a person can search for any combination in these 180 nights.
>
> Say a request came to me to give total tariff for 10th to 15th of jan 2013.
> Now I need to get a sum of tariff field of 6 docs.
>
> So how can I keep this data indexed, to avoid search time calculation, 
> and there are other dimensions of this data also beside tariff.
> Hope this makes sense.
>
> Regards
> Harshvardhan Ojha
>
> -Original Message-
> From: Gora Mohanty [mailto:g...@mimirtech.com]
> Sent: Tuesday, January 08, 2013 5:37 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Hotel Searches
>
> On 8 January 2013 17:10, Harshvardhan Ojha < 
> harshvardhan.o...@makemytrip.com> wrote:
> > Hi All,
> >
> > Looking into a finding solution for Hotel searches based on the 
> > below criteria's
> [...]
>
> Didn't you just post this on a separate thread, complete with some 
> nonsensical follow-up from a colleague of yours? Please do not repost 
> the same message over and over again.
>
> It is not clear what you are trying to achieve.
> What is the difference between a city and a hotel in your data? How is 
> a person represented in your documents? Is it by the ID field?
>
> Are you looking to cache all possible combinations of ID, city, and 
> startdate? If so, to what end?  This smells like a XY problem:
> http://people.apache.org/~hossman/#xyproblem
>
> Regards,
> Gora
>


Re: Hotel Searches

2013-01-08 Thread Alexandre Rafalovitch
Did you look at a conversation thread from 12 Dec 2012 on this list? Just
go to the archives and search for 'hotel'. Hopefully that will give you
something to work with.

If you have any questions after that, come back with more specifics.

Regards,
   Alex.

Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at
once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD book)


On Tue, Jan 8, 2013 at 7:18 AM, Harshvardhan Ojha <
harshvardhan.o...@makemytrip.com> wrote:

> Sorry for that, we just spoiled that thread so posted my question in a
> fresh thread.
>
> Problem is indeed very simple.
> I have solr documents, which has all the required fields(from db).
> Say DOC1,DOC2,DOC3.DOCn.
>
> Every document has 1 night tariff and I have 180 nights tariff.
> So a person can search for any combination in these 180 nights.
>
> Say a request came to me to give total tariff for 10th to 15th of jan 2013.
> Now I need to get a sum of tariff field of 6 docs.
>
> So how can I keep this data indexed, to avoid search time calculation, and
> there are other dimensions of this data also beside tariff.
> Hope this makes sense.
>
> Regards
> Harshvardhan Ojha
>
> -Original Message-
> From: Gora Mohanty [mailto:g...@mimirtech.com]
> Sent: Tuesday, January 08, 2013 5:37 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Hotel Searches
>
> On 8 January 2013 17:10, Harshvardhan Ojha <
> harshvardhan.o...@makemytrip.com> wrote:
> > Hi All,
> >
> > Looking into a finding solution for Hotel searches based on the below
> > criteria's
> [...]
>
> Didn't you just post this on a separate thread, complete with some
> nonsensical follow-up from a colleague of yours? Please do not repost the
> same message over and over again.
>
> It is not clear what you are trying to achieve.
> What is the difference between a city and a hotel in your data? How is a
> person represented in your documents? Is it by the ID field?
>
> Are you looking to cache all possible combinations of ID, city, and
> startdate? If so, to what end?  This smells like a XY problem:
> http://people.apache.org/~hossman/#xyproblem
>
> Regards,
> Gora
>


RE: Hotel Searches

2013-01-08 Thread Harshvardhan Ojha
Sorry for that, we just spoiled that thread so posted my question in a fresh 
thread.

Problem is indeed very simple.
I have solr documents, which has all the required fields(from db).
Say DOC1,DOC2,DOC3.DOCn.

Every document has 1 night tariff and I have 180 nights tariff.
So a person can search for any combination in these 180 nights. 

Say a request came to me to give total tariff for 10th to 15th of jan 2013.
Now I need to get a sum of tariff field of 6 docs.

So how can I keep this data indexed, to avoid search time calculation, and 
there are other dimensions of this data also beside tariff.
Hope this makes sense.

Regards
Harshvardhan Ojha

-Original Message-
From: Gora Mohanty [mailto:g...@mimirtech.com] 
Sent: Tuesday, January 08, 2013 5:37 PM
To: solr-user@lucene.apache.org
Subject: Re: Hotel Searches

On 8 January 2013 17:10, Harshvardhan Ojha  
wrote:
> Hi All,
>
> Looking into a finding solution for Hotel searches based on the below 
> criteria's
[...]

Didn't you just post this on a separate thread, complete with some nonsensical 
follow-up from a colleague of yours? Please do not repost the same message over 
and over again.

It is not clear what you are trying to achieve.
What is the difference between a city and a hotel in your data? How is a person 
represented in your documents? Is it by the ID field?

Are you looking to cache all possible combinations of ID, city, and startdate? 
If so, to what end?  This smells like a XY problem:
http://people.apache.org/~hossman/#xyproblem

Regards,
Gora


Re: Hotel Searches

2013-01-08 Thread Gora Mohanty
On 8 January 2013 17:10, Harshvardhan Ojha
 wrote:
> Hi All,
>
> Looking into a finding solution for Hotel searches based on the below 
> criteria's
[...]

Didn't you just post this on a separate thread,
complete with some nonsensical follow-up from
a colleague of yours? Please do not repost the
same message over and over again.

It is not clear what you are trying to achieve.
What is the difference between a city and a hotel
in your data? How is a person represented in
your documents? Is it by the ID field?

Are you looking to cache all possible combinations
of ID, city, and startdate? If so, to what end?  This
smells like a XY problem:
http://people.apache.org/~hossman/#xyproblem

Regards,
Gora