Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Green2011-10-22 05:07:58 +0000
committerDavid Green2011-10-22 05:07:58 +0000
commit51479097c937814c7d7f378b2aa42514fdb6c303 (patch)
tree855a756f17fb2d02e01cd588f8e5fcaed50ba842
parent441f565117399a00f7e12d003e29177d4535c197 (diff)
downloadorg.eclipse.mylyn.incubator-51479097c937814c7d7f378b2aa42514fdb6c303.tar.gz
org.eclipse.mylyn.incubator-51479097c937814c7d7f378b2aa42514fdb6c303.tar.xz
org.eclipse.mylyn.incubator-51479097c937814c7d7f378b2aa42514fdb6c303.zip
NEW - bug 191522: Provide full text search functionality over tasktask-191522-full-text-search
comments https://bugs.eclipse.org/bugs/show_bug.cgi?id=191522
-rw-r--r--org.eclipse.mylyn.tasks.index.core/src/org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex.java9
-rw-r--r--org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java24
2 files changed, 31 insertions, 2 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 63569f23..d7ba3a9d 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
@@ -97,7 +97,7 @@ public class TaskListIndex implements ITaskDataManagerListener, ITaskListChangeL
ASSIGNEE(true, TaskAttribute.USER_ASSIGNED), //
REPORTER(true, TaskAttribute.USER_REPORTER), //
PERSON(true, null), //
- COMPONTENT(true, TaskAttribute.COMPONENT), //
+ COMPONENT(true, TaskAttribute.COMPONENT), //
COMPLETION_DATE(true, null), //
CREATION_DATE(true, null), //
DUE_DATE(true, null), //
@@ -584,7 +584,9 @@ public class TaskListIndex implements ITaskDataManagerListener, ITaskListChangeL
}
private void addIndexedAttribute(Document document, IndexField indexField, String value) {
-
+ if (value == null) {
+ return;
+ }
Field field = document.getField(indexField.fieldName());
if (field == null) {
field = new Field(indexField.fieldName(), value, Store.YES, org.apache.lucene.document.Field.Index.ANALYZED);
@@ -601,6 +603,9 @@ public class TaskListIndex implements ITaskDataManagerListener, ITaskListChangeL
if (date == null) {
return;
}
+ // FIXME: date tools converts dates to GMT, and we don't really want that. So
+ // move the date by the GMT offset if there is any
+
String value = DateTools.dateToString(date, Resolution.HOUR);
Field field = document.getField(indexField.fieldName());
if (field == null) {
diff --git a/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java b/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java
index 5781fdf7..58f77db5 100644
--- a/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java
+++ b/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java
@@ -18,7 +18,9 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -201,4 +203,26 @@ public class TaskListIndexTest {
assertTrue(collector.getTasks().contains(task));
}
+ @Test
+ public void testMatchesRepositoryTaskOnCreationDate() throws InterruptedException, CoreException {
+ setupIndex();
+
+ ITask task = context.createRepositoryTask();
+
+ Date creationDate = task.getCreationDate();
+ assertNotNull(creationDate);
+
+ index.waitUntilIdle();
+
+ assertFalse(index.matches(task, IndexField.CREATION_DATE.fieldName() + ":[20010101 TO 20010105]"));
+
+ String matchDate = new SimpleDateFormat("yyyyMMdd").format(creationDate);
+ matchDate = Integer.toString(Integer.parseInt(matchDate) + 2);
+
+ String patternString = IndexField.CREATION_DATE.fieldName() + ":[20111019 TO " + matchDate + "]";
+
+ System.out.println(patternString);
+
+ assertTrue(index.matches(task, patternString));
+ }
}

Back to the top