On 6/27/2018 6:14 AM, nc-tech-user wrote:
Currently I am trying to rebuild the products filter so it will use
Solr search facet result to show its attributes. I am having some
difficulties with this solution. In most cases I'm using facet on
about 60 fields (their types are float, integer and array of
integers). To exclude some filters from facet result I'm using
"Tagging and Excluding Filters" solution
(https://lucene.apache.org/solr/guide/6_6/faceting.html#Faceting-TaggingandExcludingFilters
<https://lucene.apache.org/solr/guide/6_6/faceting.html#Faceting-TaggingandExcludingFilters>).
It works as I expect, the facet result are being build correctly with
correct facet results, but the response from Solr is very slow and
becasue of that I cannot deploy this on production (about 3.5 seconds).
I'm going to trim out your actual query.
That is a LOT of facets. I count "facet.field" in the query 74 times.
You've given Solr a rather large amount of work to do, even if the index
isn't very big. If the index is big, the amount of work is HUGE.
Faceting can be expedited by having docValues on the field. This does
increase the index size, which can by itself reduce overall Solr
performance. I would strongly recommend that you add docValues to any
field you're using for facets. A complete reindex is required after
adding docValues to the field definition.
The speed of facets is dramatically slower if the field you're faceting
on has a very large number of unique values. This is known as
"cardinality" in database circles.
https://en.wikipedia.org/wiki/Cardinality_(SQL_statements)
It might not be possible to gain much performance on a query with 74
facets in it. If I were to get a time of 3.5 seconds for a query on my
indexes with 74 facets, I'd be extremely happy. I often see query times
much larger than this with NO facets. This happens when you've got
nearly 200 million documents in the index.
One of the most common reasons for slow query performance on Solr is
insufficient system memory. If you tell me what OS you have Solr
running on, I can give you some steps for gathering information that
will allow me to make a guess about whether your system's memory is
sufficient for what you're asking Solr to do.
I have no idea how the use of tagging and excluding affects performance.
One thing to note: It looks like you're attempting to turn some of your
filters into PostFilters by using the cost attribute. You should know
that the lucene query parser (which is default) does not support the
PostFilter interface. So changing the cost of those filters is probably
not doing what you've planned. Also, once you are using a query parser
that supports PostFilter, cache must be false, or it's not a PostFilter.
A query that has many filter queries can also be quite slow, especially
if the filterCache is not getting a high hitcount.
Thanks,
Shawn