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 > <doc> > <double name="tariff">2400.0</double> > </doc> > > Doc2 > <doc> > <double name="tariff">2500.0</double> > </doc> > > Now a user's search should give me a total tariff. > > Desired result > <doc> > <double name="tariff">4900.0</double> > </doc> > > 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 >>