Bug 514795 - org.eclipse.sphinx.emf.search.ui.ModelSearchQuery.performSearch() invokes search too often
Summary: org.eclipse.sphinx.emf.search.ui.ModelSearchQuery.performSearch() invokes sea...
Status: CLOSED WONTFIX
Alias: None
Product: Sphinx
Classification: Automotive
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-05 13:20 EDT by Andreas Graf CLA
Modified: 2024-05-07 00:14 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Graf CLA 2017-04-05 13:20:24 EDT
There is a problem with search on models that can span multiple projects (e.g. Autosar, everything in a scoping resource set). The code in

org.eclipse.sphinx.emf.search.ui.ModelSearchQuery.performSearch()

The code looks like this:
		for (IProject prj : projects) {
			Collection<IModelDescriptor> models = ModelDescriptorRegistry.INSTANCE.getModels(prj);
			for (IModelDescriptor modelDescriptor : models) {
				IMetaModelDescriptor metaModelDescriptor = modelDescriptor.getMetaModelDescriptor();
				IModelSearchService modelSearchService = getModelSearchService(metaModelDescriptor);
				if (modelSearchService != null) {
					result.addAll(modelSearchService.getMatches(modelDescriptor, querySpecification));
				}
			}
		}

But, if I am not mistaken, a model / modelDescriptor can include several projects. Therefore, the search will be invoked twice, e.g. for an Artop Model that consists of two projects, resulting in n times finding the same element (one extra for each model).

The code should:

* First iterate over the projct and collect the IModelDescriptors in a Set and then iterate over that set to invoke the search for each model only once.
Comment 1 Balazs Grill CLA 2024-05-07 00:14:23 EDT
Closed stale issue before migration