2

I'm working with "edismax" and "function-query" parsers in Solr and have difficulty in understanding whether the query time taken by "function-query" makes sense. The query I'm trying to optimize looks as follows:

q={!func sum($q1,$q2,$q3)} where q1,q2,q3 are edismax queries.

The QTime returned by edismax queries takes well under 50ms but it seems that function-query is the rate determining step since combined query above takes around 200-300ms. I also analyzed the performance of function query using only constants.

The QTime results for different q are as follows:

  • 097ms for q={!func} sum(10,20)

  • 109ms for q={!func} sum(10,20,30)

  • 127ms for q={!func} sum(10,20,30,40)

  • 145ms for q={!func} sum(10,20,30,40,50)

Does this trend make sense? Are function-queries expected to be this slow?

What makes edismax queries so much faster?

What can I do to optimize my original query (which has edismax subqueries q1,q2,q3) to work under 100ms?

1 Answers1

1

func query enumerates all docs, thus it doesn't provide any selectivity. You probably don't need to evaluate it on docs, which doesn't match dismaxes eg

q=+{!v=$q1} +{!v=$q2} +{!v=$q3} {!func sum($q1,$q2,$q3)}
mkhludnev
  • 203
  • 2
  • 5
  • This doesn't work for me. Solr attempts to parse this entire string (using the deault parser) as if it were a keyword. Are you sure about this syntax, because from what I gather, a parser name should follow the "!" and it seems that Solr expects a string for the "v" parameter. – sidharth228 Apr 11 '19 at 10:08
  • 1
    pls provide the response with debugQuery=true. Also try with ```q=%2b{!v=$q1} %2b{!v=$q2} %2b{!v=$q3} {!func sum($q1,$q2,$q3)}``` – mkhludnev Apr 15 '19 at 13:13