My (our) query plugin uses specialized SolrCache's in lieu of the meta
data records. For each new searcher installed each fields possible
values will be determined and stored in a cache (off the top of my head,
some fields have a cardinality of well over 500k). Each time a query is
run that requests facets then the plugin goes to the cache to get the
DocSet that represents all the possible facets for the current search.
If none are found then it will go to the previously mentioned cache
field value cache, iterating through those values and getting the
document counts for each possible value (for the entire index, not just
the current search). These values are then again thrown into a cache.
Those DocSets are then intersected with the current result set and then
you have all your facet counts. With a bit of auto warming it's all
quite performant. All told we have 6 to 8 specialized caches, I believe
most of them are dedicated to the faceting.
Yonik Seeley wrote:
On 3/29/06, Clay Webster <[EMAIL PROTECTED]> wrote:
How could faceted browsing be accomplished without [Chris's] metadata
documents?
The most basic form:
consider if a field called "category" existed on each document.
You could then ask for the counts of the top 10 values in category
field for all of the documents matching a query.
Possible syntax: my user query; groupByField(category,10)
Another form would require the user to enumerate the facets... this
would work well for things like price ranges:
Possible syntax: my user query; groupByQueries(price:[0 TO 10},
price:[10 TO 100}, price:[100 TO 1000})
And of course, one would want to be able to specify them all in a single query:
my user query; groupByField(category,10), groupByField(author,20),
groupByQueries(price:[0 TO 10}, price:[10 TO 100}, price:[100 TO
1000})
The thing that Chris' metadata documents also did was tell you *what*
facets to do, but that logic could also be kept in the client.
Standardizing that is probably currently beyond the scope of what we
could put in the standard request handler.
-Yonik