HI all, 

Based on some good discussion in 
Modeling openinghours using multipoints
<http://lucene.472066.n3.nabble.com/Modeling-openinghours-using-multipoints-tp4025336p4025683.html>
  
I was triggered to have a review of an old painpoint of mine: modeling
pricing & availability of hotels which depends on a couple of factors
including, date or arrival, length of stay & roomtype. 

This question is to see if it would be possible to model the above using
multipoints (os ome other technique I'm not aware of that's been come into
existence in Lucene / Solr in the last 2 years or so. 

Let me explain: Hotels (in my implementation) have pricing & availability
based on: date, duration, nr of persons, roomtype (e.g.: single, double,
twin, triple, family). Instead of modeling these as separate documents,
currently I model 1 doc per hotel where each
<date*duration*persons*roomtype> combo has each own price and is modeled as
a separate field:  (configured in backend as dynamic fields: ddp-*)..
Non-availability is just modeled as the absence of the particular field. 

The advantage of modeling 1 doc per hotel is clear: users have no chance of
seeing multiple offers per hotel in the frontend. It's just how they have
become accustomed to these type of travel/ hotel searchengines. 

Now there's also a big diadvantage of my current setup: Lucene/Solr just
isn't really build for having 20.000+ fields on which can be sorted and
filtered on. (Could go into this, but it's not really the point of this
question) 

I realize the new spatial-stuff in Solr 4 is no magic bullet, but I'm
wondering if I could model multiple prices per day as multipoints, whereas: 

 - date*duration*nr of persons*roomtype is modeled as point.x (discretized
in some 20.000 values) 
 - price modeled as point.y ( in dollarcents / normalized as avg price per
day: range:  [0,200000] covering a max price of $2.000/day) 

The stuff that needs to be possible: 
 A) 1 required filter on point.x (filtering a 1 particular <date*duration*nr
of persons* roomtype> combo.
 B) an optional range query on point.y (min and./or max price filter)
 C) optional soring on point.y (sorting on price (normal or reverse))

I'm pretty certain A) and B) won't be a problem as far is functionality is
concerned, but how about performance? I.e: would some sort of cached Solr
filter jump in for a given <date*duration*nr of persons* roomtype> combo,
for quick doc-interesection, just as would with multiple dynamic fields in
my desribed as-is-case?

How about C)? Is sorting on point.y possible? (potenially in conjunction
with other sorting-fields used as tiebreaker, to give a stable sort? I
remember to have read that any filterquery can be used for sorting combined
with multipoints (which would make the above work I guess) but just would
like to confirm. 

Looking forward to your feedback, 

Best, 
Geert-Jan








--
View this message in context: 
http://lucene.472066.n3.nabble.com/modeling-prices-based-on-daterange-using-multipoints-tp4026011.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to