2

What is the difference (especially in terms of performance) between:

  1. Using a *:* query and 2 filter queries

example: http://127.0.0.1:8080/solr/select?q=*:*fl=id&fq=lat:[42.2823890429 TO 42.4224427748] AND lng:[-71.3345718384 TO -70.7612228394]

  1. Using 1 query and 1 filter query

example: http://127.0.0.1:8080/solr/select?q=lat:[42.2823890429 TO 42.4224427748]&fl=id&fq=lng:[-71.3345718384 TO -70.7612228394]

Results will be sorted according to a timestamp which was not included in the example queries above for simplicity. I am getting query times of 37 and 32 respectively for a small dataset that is expected to grow.

Nyxynyx
  • 61,411
  • 155
  • 482
  • 830

1 Answers1

4

It's all about the difference between lucene filters and queries. Filters are cacheable, thus faster. Also, filters don't influence the score of your documents. Usually a query is what the user types as query in the full text search box, while all the other ways to refine the search are pretty much defined in advance and applied as filters. The rule of thumb is: use filters when you can!

javanna
  • 59,145
  • 14
  • 144
  • 125