Description
Our permission searches used with Lucene are sub optimal now.
The inefficiencies include:
- Creating many single TermQueries connected with OR operator.
- Adding project queries with additional constraints when project query without constraint is already in the query. eg projid:123 OR (projid:123 AND reporter:USERNAM).
- Unnecessary nesting single clause queries. Instead of on query we create two Boolean queries eg (+(projid:123)) this is equal to projid:123
This is problematic as permission query is evaluated against every single segment of Lucene index. This means that JIRA searches degrades when new segments are added. Addition of segments happen when:
- Issues are modified or added
- Background reindex is performend
Number of segments is reduced to 1 when full foreground reindex is done.
We can eliminate above inefficiencies and rewrite multiple term queries into single MultiTermQuery.