3

I am trying to specify sort on a String field in my query but seeing memory issues since the index has around 50M docs.

Why is that Solr actually sorts the field values for all the documents in the index and NOT just the hits returned from the query. Is there an alternative to these performance problems.

Satya
  • 31
  • 3
  • Can you please show your request? – ffriend Oct 11 '11 at 21:19
  • Here it is... q=-uid:XXX+%2B(fid:XXX)&sort=firstName%20asc SolrQuery result = new SolrQuery(); result.setFields("uid,score,firstName"); . . . . . . result.setQuery(query.toString()); result.setSortField("firstName", ORDER.asc); – Satya Oct 11 '11 at 21:44
  • How many documents are in your index and how many are satisfied by the query? – kellyfj Nov 21 '18 at 19:13

1 Answers1

1

For your query, it may be faster to use filter queries.

q=*:*&fq=-uid:XXX&fq=%2B(fid:XXX)&sort=firstName%20asc

http://wiki.apache.org/solr/CommonQueryParameters

Jimtronic
  • 1,179
  • 1
  • 9
  • 22
  • you mean use rangeQueries as fq? – Satya Oct 11 '11 at 22:13
  • 1
    No, I find that filter queries tend to work faster because they limit the result set that can be returned, which makes the sorting easier. Since your query is simple, I would try it out. – Jimtronic Oct 12 '11 at 03:05
  • wouldn't it still load the fields values for all the documents in the index? – Satya Oct 13 '11 at 07:02