Is there a way to use regular expressions in index?

Hi Community,

I want to know if there is any way to use

StubIndexImpl.getInstance().get(JavaStubIndexKeys.FIELDS, "KEY", project, GlobalSearchScope.allScope(project));


with a regular expression for the key parameter?

Markus

3 comments

There is no way to do so directly. You can use getAllKeys() and match them against a regular expression yourself, but this is a fairly expensive operation (therefore best done in a background thread).

0

Interesting - is getAllKeys itself an expensive operation? If so, would a file based index generally be a better solution for this type of query?

0

It's kind of expensive, yes. There is no difference in the performance of getting all keys for a stub index and a file-based index.

0

Please sign in to leave a comment.