Neel, I do not think there is a way to entirely bypass spellchecking if there are results returned, and I'm not so sure performance would noticeably improve if it did this. Clients can easily check to see if results were returned and can ignore the spellcheck response in these cases, if desired.
The one exception to this is if you are using "spellcheck.collate=true" with "spellcheck.maxCollationTries" set to a value > 0. In this case, if your main query uses "o.op=OR" or a low "mm" value, you might want to force it to only return collations with all matching words. In this case you would use something like "spellcheck.collateParam.mm=100%" to be sure it only returned re-written queries for which all the words matched. The "spellcheck.maxResultsForSuggest" parameter is designed to be used in conjunction with "spellcheck.alternativeTermCount" to produce did-you-mean-style suggestions when a query returns only a few hits and at least some of the terms were in the index (but may be misspelled nevertheless). James Dyer Ingram Content Group -----Original Message----- From: neel choudhury [mailto:findneel2...@gmail.com] Sent: Sunday, September 23, 2018 2:58 PM To: solr-user@lucene.apache.org Subject: [External] Setting Spellcheck for solr only for zero result I am looking for setting up spellcheck for solr correctly. For performance reason (and avoiding confusion) I don't want to give any suggestion for any query which returns at least one result. Solr provides a parameter spellcheck.maxResultsForSuggest. For my use case i need to set is as 0 as I only want suggestions when no result is returned. However looking into the code of SpellCheckComponent in Solr i saw that for 0 value for spellcheck.maxResultsForSuggest is ignored because of greater than sign. Is there a way i can suppress spell suggestion even if 1 result is returned. private Integer maxResultsForSuggest(ResponseBuilder rb) { SolrParams params = rb.req.getParams(); float maxResultsForSuggestParamValue = params.getFloat(SpellingParams.SPELLCHECK_MAX_RESULTS_FOR_SUGGEST, 0.0f); Integer maxResultsForSuggest = null; if (maxResultsForSuggestParamValue > 0.0f) { ...} return maxResultsForSuggest }