Bug 77564 - [index] PatternSearchJob ignores participant index entries.
Summary: [index] PatternSearchJob ignores participant index entries.
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-02 23:33 EST by Phillip Avery CLA
Modified: 2006-03-31 06:26 EST (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 Phillip Avery CLA 2004-11-02 23:33:30 EST
A problem I've run into, I think I'm forced to use internal API in order to get
our JSP index entries in the IndexManager.indexLocations table.

- Java index entries are automatically added to this table when you
"computeIndexLocation", 
- but since we have to compute our own index locations, our locations don't get
added to this table.

I think being in this table is required because PatternSearchJob uses it to know
which indexes to search (it does a check what the parent container path is for
the index, which will be null if not in indexLocations table):

public Index[] getIndexes(IProgressMonitor progressMonitor) {
	// acquire the in-memory indexes on the fly
	IPath[] indexLocations = this.participant.selectIndexes(this.pattern, this.scope);
	int length = indexLocations.length;
	Index[] indexes = new Index[length];
	int count = 0;
	IndexManager indexManager =
JavaModelManager.getJavaModelManager().getIndexManager();
	for (int i = 0; i < length; i++) {
		if (progressMonitor != null && progressMonitor.isCanceled()) throw new
OperationCanceledException();
		// may trigger some index recreation work
		String indexLocation = indexLocations[i].toOSString();
		IPath containerPath = (IPath)
indexManager.indexLocations.keyForValue(indexLocation); // will be null here
because not in indexLocations table of IndexManager
		if (containerPath != null) { // sanity check
			Index index = indexManager.getIndex(containerPath, indexLocation, true
/*reuse index file*/, false /*do not create if none*/);
			if (index != null)
				indexes[count++] = index; // only consider indexes which are ready
		}
	}
	if (count == length) 
		this.areIndexesReady = true;
	else
		System.arraycopy(indexes, 0, indexes=new Index[count], 0, count);
	return indexes;
}	

I can get around this problem by adding to indexLocations in the IndexManager
when we compute our own index location, but I'm not sure if there are any bad
side effects of this.
Comment 1 Philipe Mulet CLA 2006-02-03 04:52:57 EST
Is this still an issue ?
Comment 2 Jerome Lanneluc CLA 2006-03-31 06:26:56 EST
Please reopen if this is still an issue