Index: search/search-impl/impl/src/java/org/sakaiproject/search/indexer/impl/TransactionalIndexWorker.java =================================================================== --- search/search-impl/impl/src/java/org/sakaiproject/search/indexer/impl/TransactionalIndexWorker.java (revision 51886) +++ search/search-impl/impl/src/java/org/sakaiproject/search/indexer/impl/TransactionalIndexWorker.java (working copy) @@ -48,6 +48,7 @@ import org.sakaiproject.search.indexer.api.IndexWorkerDocumentListener; import org.sakaiproject.search.indexer.api.IndexWorkerListener; import org.sakaiproject.search.indexer.api.NoItemsToIndexException; +import org.sakaiproject.search.journal.impl.JournalSettings; import org.sakaiproject.search.model.SearchBuilderItem; import org.sakaiproject.search.transaction.api.IndexTransaction; import org.sakaiproject.search.transaction.api.IndexTransactionException; @@ -97,10 +98,9 @@ private List indexWorkerDocumentListeners = new ArrayList(); private ThreadLocalManager threadLocalManager; - + public void init() { - } public void destroy() @@ -318,6 +318,19 @@ doc.add(new Field(SearchService.FIELD_CONTEXT, filterNull(sep.getSiteId(ref)), Field.Store.COMPRESS, Field.Index.UN_TOKENIZED)); + + // add the ID to the contents to trap the filename + String idIndex = filterPunctuation(sep.getId(ref)); + doc.add(new Field(SearchService.FIELD_CONTENTS, + idIndex, Field.Store.COMPRESS, + Field.Index.TOKENIZED, Field.TermVector.YES)); + + // add the title + String title = filterPunctuation(sep.getTitle(ref)); + doc.add(new Field(SearchService.FIELD_CONTENTS, + title, Field.Store.COMPRESS, + Field.Index.TOKENIZED, Field.TermVector.YES)); + if (sep.isContentFromReader(ref)) { contentReader = sep.getContentReader(ref); @@ -338,7 +351,7 @@ + content + "]"); } doc.add(new Field(SearchService.FIELD_CONTENTS, - filterNull(content), Field.Store.NO, + filterNull(content), Field.Store.COMPRESS, Field.Index.TOKENIZED, Field.TermVector.YES)); } @@ -497,6 +510,19 @@ } + private String filterPunctuation(String term) { + if ( term == null ) { + return ""; + } + char[] endTerm = term.toCharArray(); + for ( int i = 0; i < endTerm.length; i++ ) { + if ( !Character.isLetterOrDigit(endTerm[i]) ) { + endTerm[i] = ' '; + } + } + return new String(endTerm); + } + /** * */