Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Questions about indexing

So with the recent flurry of activity on indexing I thought .. well now
be the time to start looking at improving the current content assist.  So I
started looking into the indexing ... and I got confused.

There is the original IndexModel defined in
Using this very simple indexing model I would do:

    IndexModel model = IndexModel.getDefault();
    ITagEntry [] tags = model.query(project, "*string-reg-exp*", false,

Which was mega simple, but also very far from being complete (even though
tags theoretically included lots of additional information about variables
and types etc).

Looking into the search stuff under development I found the new indexing
    CModelManager modelManager = CModelManager.getDefault();
    IndexManager indexManager = modelManager.getIndexManager();

    indexManager.performConcurrentJob(new PatternSearchJob(),


I looked at PatternSearchJob() and it is pretty well an empty shell at the
moment since
it is under development, but even then I don't see what the interaction is
between this
class and the actual "searching for something" since there is also a
mysterious MatchLocator/
ICSearchPattern whose roles have to do with reporting the match back, but
seem to be
distantly located from the the indexManager and more related to the

My question is, can someone outline the basic flow of how I would be able to
use the
facilities of the new indexer to programmatically generate an array of
entries which might
match a given expression.  As a starter I'll provide my current guess (and
its problems?):

- Create a new search engine using SearchEngine()
- Create a search pattern using SearchEngine.createSearchPattern()
- Create a collector which will grab the results and stuff them somewhere
- Limit the scope appropriately and execute the search engine with the above
  pieces (incidentally can I limit the scope to variables local to a
function? Can
I limit the scope to global variables? ... didn't see this in the

My question on this, is that the results returned back by the collector are
file oriented, though there is an ICElement included.  Lets say that I
submit a
query and get back a function and a variable: foofunc and foovar.
- I can get the element name: Great!
- Can I get the return value/parameters for a function or the type
for a variable?  Is is possible to go back to the model easily given an
to extract this information?

I'll wait until I hear back on this until I decided to go further and
replace/enhance the
editor code completion facility.


Back to the top