Re: How to Facet on a price range

2010-11-13 Thread Govind Kanshi
Kudos to Jan's pre-compute option and gwk's range facet answer.

On Wed, Nov 10, 2010 at 2:52 PM, Geert-Jan Brits gbr...@gmail.com wrote:

 Ah I see: like you said it's part of the facet range implementation.
 Frontend is already working, just need the 'update-on-slide' behavior.

 Thanks
 Geert-Jan

 2010/11/10 gwk g...@eyefi.nl

  On 11/9/2010 7:32 PM, Geert-Jan Brits wrote:
 
  when you drag the sliders , an update of how many results would match is
  immediately shown. I really like this. How did you do this? IS this
  out-of-the-box available with the suggested Facet_by_range patch?
 
 
  Hi,
 
  With the range facets you get the facet counts for every discrete step of
  the slider, these values are requested in the AJAX request whenever
 search
  criteria change and then someone uses the sliders we simply check the
 range
  that is selected and add the discrete values of that range to get the
  expected amount of results. So yes it is available, but as Solr is just
 the
  search backend the frontend stuff you'll have to write yourself.
 
  Regards,
 
  gwk
 



Re: How to Facet on a price range

2010-11-10 Thread gwk

On 11/9/2010 7:32 PM, Geert-Jan Brits wrote:

when you drag the sliders , an update of how many results would match is
immediately shown. I really like this. How did you do this? IS this
out-of-the-box available with the suggested Facet_by_range patch?


Hi,

With the range facets you get the facet counts for every discrete step 
of the slider, these values are requested in the AJAX request whenever 
search criteria change and then someone uses the sliders we simply check 
the range that is selected and add the discrete values of that range to 
get the expected amount of results. So yes it is available, but as Solr 
is just the search backend the frontend stuff you'll have to write yourself.


Regards,

gwk


Re: How to Facet on a price range

2010-11-10 Thread Geert-Jan Brits
Ah I see: like you said it's part of the facet range implementation.
Frontend is already working, just need the 'update-on-slide' behavior.

Thanks
Geert-Jan

2010/11/10 gwk g...@eyefi.nl

 On 11/9/2010 7:32 PM, Geert-Jan Brits wrote:

 when you drag the sliders , an update of how many results would match is
 immediately shown. I really like this. How did you do this? IS this
 out-of-the-box available with the suggested Facet_by_range patch?


 Hi,

 With the range facets you get the facet counts for every discrete step of
 the slider, these values are requested in the AJAX request whenever search
 criteria change and then someone uses the sliders we simply check the range
 that is selected and add the discrete values of that range to get the
 expected amount of results. So yes it is available, but as Solr is just the
 search backend the frontend stuff you'll have to write yourself.

 Regards,

 gwk



Re: How to Facet on a price range

2010-11-09 Thread Geert-Jan Brits
Just to add to this, if you want to allow the user more choice in his option
to select ranges, perhaps by using a 2-sided javasacript slider for the
pricerange (ala kayak.com) it may be very worthwhile to discretize the
allowed values for the slider (e.g: steps of 5 dolllar) Most js-slider
implementations allow for this easily.

This has the advantages of:
- having far fewer possible facetqueries and thus a far greater chance of
these facetqueries hitting the cache.
- a better user-experience, although that's debatable.

just to be clear: for this the Solr-side would still use:
facet=onfacet.query=price:[50
TO *]facet.query=price:[* TO 100] and not the optimized pre-computed
variant suggested above.

Geert-Jan

2010/11/9 jayant jayan...@hotmail.com


 That was very well thought of and a clever solution. Thanks.
 --
 View this message in context:
 http://lucene.472066.n3.nabble.com/How-to-Facet-on-a-price-range-tp1846392p1869201.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: How to Facet on a price range

2010-11-09 Thread jayant

That was very well thought of and a clever solution. Thanks.
-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-Facet-on-a-price-range-tp1846392p1869201.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: How to Facet on a price range

2010-11-09 Thread gwk

Hi,

Instead of all the facet queries, you can also make use of range facets 
(http://wiki.apache.org/solr/SimpleFacetParameters#Facet_by_Range), 
which is in trunk afaik, it should also be patchable into older versions 
of Solr, although that should not be necessary.


We make use of it (http://www.mysecondhome.co.uk/search.html) to create 
the nice sliders Geert-Jan describes. We've also used it to add the 
sparklines above the sliders which give a nice indication of how the 
current selection is spread out.


Regards,

gwk

On 11/9/2010 3:33 PM, Geert-Jan Brits wrote:

Just to add to this, if you want to allow the user more choice in his option
to select ranges, perhaps by using a 2-sided javasacript slider for the
pricerange (ala kayak.com) it may be very worthwhile to discretize the
allowed values for the slider (e.g: steps of 5 dolllar) Most js-slider
implementations allow for this easily.

This has the advantages of:
- having far fewer possible facetqueries and thus a far greater chance of
these facetqueries hitting the cache.
- a better user-experience, although that's debatable.

just to be clear: for this the Solr-side would still use:
facet=onfacet.query=price:[50
TO *]facet.query=price:[* TO 100] and not the optimized pre-computed
variant suggested above.

Geert-Jan

2010/11/9 jayantjayan...@hotmail.com


That was very well thought of and a clever solution. Thanks.
--
View this message in context:
http://lucene.472066.n3.nabble.com/How-to-Facet-on-a-price-range-tp1846392p1869201.html
Sent from the Solr - User mailing list archive at Nabble.com.





Re: How to Facet on a price range

2010-11-09 Thread Geert-Jan Brits
@ 
http://www.mysecondhome.co.uk/search.htmhttp://www.mysecondhome.co.uk/search.html
--
when you drag the sliders , an update of how many results would match is
immediately shown. I really like this. How did you do this? IS this
out-of-the-box available with the suggested Facet_by_range patch?

Thanks,
Geert-Jan

2010/11/9 gwk g...@eyefi.nl

 Hi,

 Instead of all the facet queries, you can also make use of range facets (
 http://wiki.apache.org/solr/SimpleFacetParameters#Facet_by_Range), which
 is in trunk afaik, it should also be patchable into older versions of Solr,
 although that should not be necessary.

 We make use of it (http://www.mysecondhome.co.uk/search.html) to create
 the nice sliders Geert-Jan describes. We've also used it to add the
 sparklines above the sliders which give a nice indication of how the current
 selection is spread out.

 Regards,

 gwk


 On 11/9/2010 3:33 PM, Geert-Jan Brits wrote:

 Just to add to this, if you want to allow the user more choice in his
 option
 to select ranges, perhaps by using a 2-sided javasacript slider for the
 pricerange (ala kayak.com) it may be very worthwhile to discretize the
 allowed values for the slider (e.g: steps of 5 dolllar) Most js-slider
 implementations allow for this easily.

 This has the advantages of:
 - having far fewer possible facetqueries and thus a far greater chance of
 these facetqueries hitting the cache.
 - a better user-experience, although that's debatable.

 just to be clear: for this the Solr-side would still use:
 facet=onfacet.query=price:[50
 TO *]facet.query=price:[* TO 100] and not the optimized pre-computed
 variant suggested above.

 Geert-Jan

 2010/11/9 jayantjayan...@hotmail.com

  That was very well thought of and a clever solution. Thanks.
 --
 View this message in context:

 http://lucene.472066.n3.nabble.com/How-to-Facet-on-a-price-range-tp1846392p1869201.html
 Sent from the Solr - User mailing list archive at Nabble.com.





Re: How to Facet on a price range

2010-11-05 Thread Ahmet Arslan
 I am able to facet on a particular field because I have
 index on that field.
 But I am not sure how to facet on a price range when I have
 the exact price
 in the 'price' field. Can anyone help here.


Something like this:

facet=onfacet.query=price:[* TO 500]facet.query=price:[500 TO *]

Additionally you can get min and max price of your query results with 
http://wiki.apache.org/solr/StatsComponent


  


Re: How to Facet on a price range

2010-11-05 Thread Peter Karich
 take a look here 
http://stackoverflow.com/questions/33956/how-to-get-facet-ranges-in-solr-results



I am able to facet on a particular field because I have index on that field.
But I am not sure how to facet on a price range when I have the exact price
in the 'price' field. Can anyone help here.
Thanks




--
http://jetwick.com twitter search prototype



Re: How to Facet on a price range

2010-11-05 Thread jayant

Thank you both. Faceting is now working on a range.
-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-Facet-on-a-price-range-tp1846392p1848716.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: How to Facet on a price range

2010-11-05 Thread Jan Høydahl / Cominvent
Note that using many facet.query= parameters may be expensive.
Another way to solve this is to pre-compute the ranges as plain strings in 
another field during indexing.
This can be done in your app prior to indexing or by creating a new FieldType 
for your range. Here's a field type that computes the strings for you. Simply 
do a copyField from your price field to e.g. price_s, and facet on 
price_s instead of price:

fieldtype name=priceclass class=solr.TextField
  analyzer
tokenizer class=solr.KeywordTokenizerFactory/
filter class=solr.PatternReplaceFilterFactory 
pattern=^([0-9]{0,2})([\.,][0-9]{1,2})?$ replacement=0 - 99 replace=all /
filter class=solr.PatternReplaceFilterFactory 
pattern=^(1[0-9][0-9]|2[0-4][0-9]|)([\.,][0-9]{1,2})?$ replacement=100 - 
249 replace=all /
filter class=solr.PatternReplaceFilterFactory 
pattern=^(2[5-9][0-9]|[3-4][0-9][0-9])([\.,][0-9]{1,2})?$ replacement=250 - 
499 replace=all /
filter class=solr.PatternReplaceFilterFactory 
pattern=^([5-9][0-9][0-9])([\.,][0-9]{1,2})?$ replacement=500 - 999 
replace=all /
filter class=solr.PatternReplaceFilterFactory 
pattern=^([0-9]{4,5})([\.,][0-9]{1,2})?$ replacement=999 - replace=all /
  /analyzer
/fieldtype

It adds to your index size, but is optimized for query speed.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

On 5. nov. 2010, at 16.03, jayant wrote:

 
 Thank you both. Faceting is now working on a range.
 -- 
 View this message in context: 
 http://lucene.472066.n3.nabble.com/How-to-Facet-on-a-price-range-tp1846392p1848716.html
 Sent from the Solr - User mailing list archive at Nabble.com.



How to Facet on a price range

2010-11-04 Thread jayant

I am able to facet on a particular field because I have index on that field.
But I am not sure how to facet on a price range when I have the exact price
in the 'price' field. Can anyone help here.
Thanks
-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-Facet-on-a-price-range-tp1846392p1846392.html
Sent from the Solr - User mailing list archive at Nabble.com.