Merge: src/indexing: Introduces CodeIndex
authorJean Privat <jean@pryen.org>
Wed, 20 Jun 2018 18:59:09 +0000 (14:59 -0400)
committerJean Privat <jean@pryen.org>
Wed, 20 Jun 2018 18:59:09 +0000 (14:59 -0400)
commitbe92c2280ff8c251167ef52da1377d3166a84e08
tree5f47b6fa28dde4fa954d4864b7bfb94f062de5c9
parentb59bc7a6d14201c8abbe9993326e8795e3524e68
parentccfa4406ab606053d455479ec732cd5adac3292c
Merge: src/indexing: Introduces CodeIndex

This PR introduces a new Index based on VSM: CodeIndex, which can be used to retrieve pieces of code from a code query.

Model entities are indexed by their ANode and vectorization is based on model usage such as:
* modules importation
* classes spcialization and refinement
* methods calls and refinements

Example:
~~~nit
# Create the index
var index = new CodeIndex(toolcontext)
for mentity in mentities do
  index.index_mentity(mentity)
end

# Match a piece of code
var matches = index.match_code("print \"Hello, World!\"")
for match in matches do
  print match
end
~~~

Pull-Request: #2719