terrier-org / terrier-core

Terrier IR Platform
http://terrier.org/
Other
254 stars 62 forks source link

Modern replacement needed for Index.setIndexLoadingProfileAsRetrieval() #105

Open cmacdonald opened 4 years ago

cmacdonald commented 4 years ago

The method Index.setIndexLoadingProfileAsRetrieval() was always a hack.

I propose extending the IndexFactory.of() with an optional IndexProfile enum, which will hint to the Index(Loader) how it should load.

class IndexFactory {
  public Index of(IndexRef ref, IndexProfile profile);
  public Index of(IndexRef ref) { of (ref, IndexProfile.NORMAL); }
}
public enum IndexProfile {
  SMALL,
  NORMAL,
  FAST
} 

For IndexOnDisk, this will be interpreted as follows:

Per-structure configuration:

cmacdonald commented 4 years ago

An alternative would be an option called String[] preload, (or List preload) that specifies the structures that should be loaded into memory?

tonellotto commented 4 years ago

This last option could be used internally, but not exposed; avoid to give users too much rope... one simple strategy pattern is enough :-)