Skip to main content

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

cdt-dev-admin@xxxxxxxxxxx wrote on 07/06/2003 02:30:26 PM:

> So with the recent flurry of activity on indexing I thought .. well now
> might
> 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
> index/org.eclipse.cdt.core.index.
> Using this very simple indexing model I would do:
>     IndexModel model = IndexModel.getDefault();
>     ITagEntry [] tags = model.query(project, "*string-reg-exp*", false,
> false);
> Which was mega simple, but also very far from being complete (even though
> the
> tags theoretically included lots of additional information about variables
> and types etc).
> Looking into the search stuff under development I found the new indexing
> stuff
>     CModelManager modelManager = CModelManager.getDefault();
>     IndexManager indexManager = modelManager.getIndexManager();
>     indexManager.performConcurrentJob(new PatternSearchJob(),
>                                                               monitor);
> 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
> parser/model.

PatternSearchJob is very much an empty shell at this point. It is missing its all
important search method...

The search work flow in terms of the indexer are:

- SearchEngine schedules a new PatternSearchJob with the IndexManager
- PatternSearchJob creates a new IndexSelector which uses the passed in scope
  to create a filter into the existing indexes
- IndexSelector gets the "interesting" indexes from the IndexManager
- PatternSearch iterates through all of the retrieved indexes and calls findIndexMatches
- findIndexMatches opens the index and queries the index for entries of interest
- Matches are added to the PathCollector
- Once all the indexes are processed, the MatchLocator goes to work on the paths in the PathCollector -> Andrew's
  email continues from this point on

> 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?

Local variables will not be indexed.

> I limit the scope to global variables? ... didn't see this in the
> definition).
> My question on this, is that the results returned back by the collector are
> mostly
> 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
> information
> for a variable?  Is is possible to go back to the model easily given an
> ICElement
> 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.
> Thanks,
>   Thomas
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx

Back to the top