diff options
author | Jaxsun McCarthy Huggan | 2017-06-20 22:36:28 +0000 |
---|---|---|
committer | Jaxsun McCarthy Huggan | 2017-06-20 23:33:10 +0000 |
commit | 3903deed2e964f8e650a588ea5472fdcb765bee0 (patch) | |
tree | dfbf2d72f8dbdd24fd624135f3e62cfbb8287fb9 /org.eclipse.mylyn.tasks.index.core/src | |
parent | 1b0cf590566558e26da4515a1cf700ae700f5e48 (diff) | |
download | org.eclipse.mylyn.tasks-3903deed2e964f8e650a588ea5472fdcb765bee0.tar.gz org.eclipse.mylyn.tasks-3903deed2e964f8e650a588ea5472fdcb765bee0.tar.xz org.eclipse.mylyn.tasks-3903deed2e964f8e650a588ea5472fdcb765bee0.zip |
518536: TaskListIndex respects all submitted query terms
Change-Id: If058bfb65718e15370b9f569d30125c709b22208
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=518536
Diffstat (limited to 'org.eclipse.mylyn.tasks.index.core/src')
-rw-r--r-- | org.eclipse.mylyn.tasks.index.core/src/org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/org.eclipse.mylyn.tasks.index.core/src/org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex.java b/org.eclipse.mylyn.tasks.index.core/src/org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex.java index 91f5d62c3..646e3f708 100644 --- a/org.eclipse.mylyn.tasks.index.core/src/org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex.java +++ b/org.eclipse.mylyn.tasks.index.core/src/org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex.java @@ -719,13 +719,12 @@ public class TaskListIndex implements ITaskDataManagerListener, ITaskListChangeL for (BooleanClause clause : query.clauses()) { if (clause.getQuery() instanceof TermQuery) { TermQuery termQuery = (TermQuery) clause.getQuery(); - clause = new BooleanClause(new PrefixQuery(termQuery.getTerm()), clause.getOccur()); - qb.add(clause); - } - if (!hasBooleanSpecifiers) { + clause = new BooleanClause(new PrefixQuery(termQuery.getTerm()), + computeOccur(clause, hasBooleanSpecifiers)); + } else if (!hasBooleanSpecifiers) { clause = new BooleanClause(clause.getQuery(), Occur.MUST); - qb.add(clause); } + qb.add(clause); } q = qb.build(); } else if (q instanceof TermQuery) { @@ -734,6 +733,13 @@ public class TaskListIndex implements ITaskDataManagerListener, ITaskListChangeL return q; } + private Occur computeOccur(BooleanClause clause, boolean hasBooleanSpecifiers) { + if (!hasBooleanSpecifiers) { + return Occur.MUST; + } + return clause.getOccur(); + } + private boolean containsSpecialCharacters(String patternString) { return patternString.indexOf(':') >= 0 || patternString.indexOf('"') >= 0 || patternString.indexOf('*') >= 0 || patternString.indexOf('?') >= 0; @@ -966,8 +972,9 @@ public class TaskListIndex implements ITaskDataManagerListener, ITaskListChangeL } if (isPersonField(indexField)) { - IRepositoryPerson repositoryPerson = attribute.getTaskData().getAttributeMapper().getRepositoryPerson( - attribute); + IRepositoryPerson repositoryPerson = attribute.getTaskData() + .getAttributeMapper() + .getRepositoryPerson(attribute); addIndexedAttribute(document, indexField, repositoryPerson); if (values.size() <= 1) { |