gerlowskija opened a new pull request, #2499:
URL: https://github.com/apache/solr/pull/2499

   https://issues.apache.org/jira/browse/SOLR-17195
   
   
   # Description
   
   Prefix-based queries consume memory in proportion to the number of terms in 
the index that start with the prefix.  Short prefixes tend to match many more 
indexed terms, and consume more memory as a result, often causing instability 
issues on the node.
   
   Yet Solr (prior to this PR) offers no way to restrict the prefixes used in 
queries.
   
   # Solution
   
   This PR adds a solrconfig.xml property, `minPrefixLength`, which operates 
similarly to the existing `maxBooleanClauses`.  Users who submit a query with a 
prefix shorter than the minimal acceptable length will receive an error of the 
form:
   
   ```
   Query <snip> does not meet the minimum prefix length [2] (actual=[1]).  
Please try with a larger prefix, or adjust minPrefixLength in your 
solrconfig.xml
   ```
   Some notes on the implementation:
   
   - currently only enforced for 'string' fields, where this cardinality 
problem occurs most frequently
   - defaults to '2' in the default configset, prohibiting only 
single-character prefixes.
   - can be overridden in the default configset with the 
`solr.min.prefixLength` sysprop/env-var
     
   # Tests
   
   Tests for solrconfig.xml in `SolrCoreTest`. Additional tests on actual 
functionality still needed.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x] I have reviewed the guidelines for [How to 
Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my 
code conforms to the standards described there to the best of my ability.
   - [x] I have created a Jira issue and added the issue ID to my pull request 
title.
   - [x] I have given Solr maintainers 
[access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
 to contribute to my PR branch. (optional but recommended)
   - [x] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference 
Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to