You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by sivaprasad <si...@echidnainc.com> on 2011/01/20 18:39:18 UTC
Adding weightage to the facets count
Hi,
I am building tag cloud for products by using facets.I made tag names as
facets and i am taking facets count as reference to display tag cloud.Each
product has tags with their own weightage.Let us say,
For example
prod1 has tag called “Light Weight” with weightage 20,
prod2 has tag called “Light Weight” with weightage 100,
If i get facet for “Light Weight” , i will get Light Weight (2) ,
here i need to consider the weightage in to account, and the result will be
Light Weight (120)
How can we achieve this?Any ideas are really helpful.
Regards,
Siva
--
View this message in context: http://lucene.472066.n3.nabble.com/Adding-weightage-to-the-facets-count-tp2295308p2295308.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Adding weightage to the facets count
Posted by Jonathan Rochkind <ro...@jhu.edu>.
Maybe?: Just keep the 'weightages' in an external store of some kind
(rdbms, nosql like mongodb, just a straight text config file that your
app loads into a hash internally, whatever), rather than Solr, and have
your app look them up for each facet value to be displayed, after your
app fetches the facet values from Solr. There's no need to use Solr for
this, although there might be various tricky ways to do so if you really
wanted to, there's no perfectly straightforward way.
On 1/20/2011 12:39 PM, sivaprasad wrote:
> Hi,
>
> I am building tag cloud for products by using facets.I made tag names as
> facets and i am taking facets count as reference to display tag cloud.Each
> product has tags with their own weightage.Let us say,
>
> For example
>
> prod1 has tag called “Light Weight” with weightage 20,
> prod2 has tag called “Light Weight” with weightage 100,
>
> If i get facet for “Light Weight” , i will get Light Weight (2) ,
> here i need to consider the weightage in to account, and the result will be
> Light Weight (120)
>
> How can we achieve this?Any ideas are really helpful.
>
> Regards,
> Siva
>
Re: Adding weightage to the facets count
Posted by Johannes Goll <jo...@gmail.com>.
Hi Siva,
try using the Solr Stats Component
http://wiki.apache.org/solr/StatsComponent
similar to
select/?&q=*:*&stats=true&stats.field={your-weight-field}&stats.facet={your-facet-field}
and get the sum field from the response. You may need to resort the weighted
facet counts to get a descending list of facet counts.
Note, there is a bug for using the Stats Component with multi-valued facet
fields.
For details see
https://issues.apache.org/jira/browse/SOLR-1782
Johannes
2011/1/24 Chris Hostetter <ho...@fucit.org>
>
> : prod1 has tag called “Light Weight” with weightage 20,
> : prod2 has tag called “Light Weight” with weightage 100,
> :
> : If i get facet for “Light Weight” , i will get Light Weight (2) ,
> : here i need to consider the weightage in to account, and the result will
> be
> : Light Weight (120)
> :
> : How can we achieve this?Any ideas are really helpful.
>
>
> It's not really possible with Solr out of the box. Faceting is fast and
> efficient in Solr because it's all done using set intersections (and most
> of the sets can be kept in ram very compactly and reused). For what you
> are describing you'd need to no only assocaited a weighted payload with
> every TermPosition, but also factor that weight in when doing the
> faceting, which means efficient set operations are now out the window.
>
> If you know java it would be probably be possible to write a custom
> SolrPlugin (a SearchComponent) to do this type of faceting in special
> cases (assuming you indexed in a particular way) but i'm not sure off hte
> top of my head how well it would scale -- the basic algo i'm thinking of
> is (after indexing each facet term wit ha weight payload) to iterate over
> the DocSet of all matching documents in parallel with an iteration over
> a TermPositions, skipping ahead to only the docs that match the query, and
> recording the sum of the payloads for each term.
>
> Hmmm...
>
> except TermPositions iterates over <term, <doc, freq, <position>>> tuples,
> so you would have to iterate over every term, and for every term then loop
> over all matching docs ... like i said, not sure how efficient it would
> wind up being.
>
> You might be happier all arround if you just do some sampling -- store the
> tag+weight pairs so thta htey cna be retireved with each doc, and then
> when you get your top facet constraints back, look at the first page of
> results, and figure out what the sun "weight" is for each of those
> constraints based solely on the page#1 results.
>
> i've had happy users using a similar appraoch in the past.
>
> -Hoss
--
Johannes Goll
211 Curry Ford Lane
Gaithersburg, Maryland 20878
Re: Adding weightage to the facets count
Posted by Chris Hostetter <ho...@fucit.org>.
: prod1 has tag called “Light Weight” with weightage 20,
: prod2 has tag called “Light Weight” with weightage 100,
:
: If i get facet for “Light Weight” , i will get Light Weight (2) ,
: here i need to consider the weightage in to account, and the result will be
: Light Weight (120)
:
: How can we achieve this?Any ideas are really helpful.
It's not really possible with Solr out of the box. Faceting is fast and
efficient in Solr because it's all done using set intersections (and most
of the sets can be kept in ram very compactly and reused). For what you
are describing you'd need to no only assocaited a weighted payload with
every TermPosition, but also factor that weight in when doing the
faceting, which means efficient set operations are now out the window.
If you know java it would be probably be possible to write a custom
SolrPlugin (a SearchComponent) to do this type of faceting in special
cases (assuming you indexed in a particular way) but i'm not sure off hte
top of my head how well it would scale -- the basic algo i'm thinking of
is (after indexing each facet term wit ha weight payload) to iterate over
the DocSet of all matching documents in parallel with an iteration over
a TermPositions, skipping ahead to only the docs that match the query, and
recording the sum of the payloads for each term.
Hmmm...
except TermPositions iterates over <term, <doc, freq, <position>>> tuples,
so you would have to iterate over every term, and for every term then loop
over all matching docs ... like i said, not sure how efficient it would
wind up being.
You might be happier all arround if you just do some sampling -- store the
tag+weight pairs so thta htey cna be retireved with each doc, and then
when you get your top facet constraints back, look at the first page of
results, and figure out what the sun "weight" is for each of those
constraints based solely on the page#1 results.
i've had happy users using a similar appraoch in the past.
-Hoss