scala-ide/scala-search — pull request #15 by mads379 (2013-02-15 13:49:24+00:00)
Title: Stores occurrences of methods in Lucene

The plugin now keeps an Index (using Lucene) of all the places methods are mentioned in the code-base.

The initial index will be created upon start-up if no index exists already. It will index the entire workspace and traverse the parse-tree of all Scala sources.

Using a background job we continuously update the index of all files that are changed so it always reflect the state of the files in the workspace. We currently assume that no other applications will change the source files when Eclipse is closed.

Also added a test that shows that we can store and retrieve information from Lucene and that it's able to serialize and de-serialize the abstraction we use to represent an Occurrence.

A little bit of guide to the code:

- **SearchPlugin** is the main entry point. It starts the indexing jobs
- **Occurrence** is the abstraction we use for an occurrence of something we're interested in. It is also where the mapping to/from Lucene document happens
- **OccurrenceCollector** is the class responsible to traversing parse-trees and extract the things we care about
- **LuceneIndex** is out index implementation. Pretty basic for now
- **SourceIndexer** takes care of indexing a file/workspace/anything (but just the sources)
- the jobs package contains the indexing jobs implementations

Enjoy,
Mads