Provides access to the branch/commit currently checked out. Stores information on dirty objects. Dirty objects are those which have been added or changed before the next commit.
Thread-safety: This class is NOT thread-safe. {@link MongoDBVDatabase} will hold a thread-local variable to restrictaccess to this object.
@author Michel KraemerAn index is immutable. Changing the value of an entry will return a new index with the specified change, but leave the original index untouched.
All implementations of this interface must be thread-safe. @author Torsten Nahm
Often one uses a List to associate a unique index with each Object (e.g. controlled vocabulary, feature map, etc.). Index offers constant-time performance for both index -> Object
( {@link #get(int)}) and Object -> index
( {@link #indexOf(Object)}) as well as for {@link #contains(Object)}. Otherwise it behaves like a normal list. Index also supports {@link #lock()} and {@link #unlock()} to ensure that it'sonly modified when desired.
Concrete subclasses of this class represent abstract index access information: for instance, the basename or IP address/port, flags, etc. It allows to build easily {@linkplain IndexReader index readers} over the index:in turn, index readers provide {@linkplain it.unimi.dsi.mg4j.search.DocumentIterator document iterators}.
In principle, this class should just contain methods declarations, and attributes for all data that is common to any form of index. Note that we use an abstract class, rather than an interface, because interfaces do not allow to declare attributes.
This class provide static factory methods (e.g., {@link #getInstance(CharSequence)}) that return an index given a suitable URI string. If the scheme part is mg4j, then the URI is assumed to point at a remote index. Otherwise, it is assumed to be the basename of a local index. In both cases, a query part introduced by ? can specify additional parameters (key=value pairs separated by ;). For instance, the URI example?inmemory=1 will load the index with basename example, caching its content in core memory. Please have a look at constants in {@link Index.UriKeys} (and analogous enums in subclasses) for additional parameters.
Indices are a natural candidate for multithreaded access. An instance of this class must be thread safe as long as external data structures provided to its constructors are. For instance, the tool {@link it.unimi.dsi.mg4j.tool.IndexBuilder} generatesa {@linkplain StringMaps#synchronize(PrefixMap) synchronized} {@link ImmutableExternalPrefixMap}so that by default the resulting index is thread safe.
For instance, a {@link it.unimi.dsi.mg4j.index.DiskBasedIndex} requires a list ofterm offsets, term maps, etc. As long as all these data structures are thread safe, the same is true of the index. Data structures created by static factory methods such as {@link it.unimi.dsi.mg4j.index.DiskBasedIndex#getInstance(CharSequence)} are thread safe.
Note that {@link it.unimi.dsi.mg4j.index.IndexReader}s returned by {@link #getReader()}are not thread safe (even if the method {@link #getReader()} is). The logic behindthis arrangement is that you create as many reader as you need, and then {@link java.io.Closeable#close()} them. In a multithreadedenvironment, a pool of index readers can be created, and a custom {@link it.unimi.dsi.mg4j.query.nodes.QueryBuilderVisitor}can be used to build {@link it.unimi.dsi.mg4j.search.DocumentIterator}s using the given pool of readers. In this case readers are not closed, but rather reused.
Implementations of this class are strongly encouraged to offer read-once constructors and factory methods: property files and other data related to the index (but not to an {@link it.unimi.dsi.mg4j.index.IndexReader}should be read exactly once, and sequentially. This feature is very useful when {@linkplain it.unimi.dsi.mg4j.tool.Combine combining indices}. @author Paolo Boldi @author Sebastiano Vigna @since 0.9
This class represents a unique index which can be used instead of java.lang.Integer
for primitive data types collections. For example:[code] class SparseVector
Unicity is guaranteed and direct equality (==
) can be used in place of object equality (Index.equals(Object)
).
Indices have no adverse effect on the garbage collector (persistent instances), but should not be used for large integer values as that would increase the permanent memory footprint significantly.
RTSJ: Instance of this classes are allocated in ImmortalMemory
. Indices can be pre-allocated at start-up to avoid run-time allocation delays by configuring {@link #INITIAL_FIRST} and/or {@link #INITIAL_LAST} or through {@link #setMinimumRange}.
Syntax :
INDEX ( reference, row_num[, column_num [, area_num]]) INDEX ( array, row_num[, column_num])
reference | typically an area reference, possibly a union of areas |
---|---|
array | a literal array value (currently not supported) |
row_num | selects the row within the array or area reference |
column_num | selects column within the array or area reference. default is 1 |
area_num | used when reference is a union of areas |
Interface of an index declaration.
@author Jochen WiedmannIndex
maps document names to their referenced words in various categories. Queries can search a single category or several at the same time. Indexes are not synchronized structures and should only be queried/updated one at a time.
Index
maps document names to their referenced words in various categories. Queries can search a single category or several at the same time. Indexes are not synchronized structures and should only be queried/updated one at a time.
This class is configured via XML (i.e. a console-config.xml file). This is done via the HK2 ConfigParser
.
This class is configured via XML (i.e. a console-config.xml file). This is done via the HK2 ConfigParser
.
The Index uses an {@link StagingDatabase object database} as storage for the staged changes. Thisallows for really large operations not to eat up too much heap, and also works better and allows for easier implementation of operations that need to manipulate the index.
The Index database is a composite of its own ObjectDatabase and the repository's. Object look ups against the index first search on the index db, and if not found defer to the repository object db.
Internally, finding out what changes are unstaged is a matter of comparing (through a diff tree walk) the working tree and the staged changes tree. And finding out what changes are staged to be committed is performed through a diff tree walk comparing the staged changes tree and the repository's head tree.
Each time ModeShape uses this index, it calls the {@link #filter(IndexConstraints)} method with a set of{@link IndexConstraints} to obtain an {@link org.modeshape.jcr.spi.index.provider.Filter.Results} instance that ModeShape willthen use to {@link org.modeshape.jcr.spi.index.provider.Filter.Results#getNextBatch(ResultWriter,int) access} the batches ofnode keys that satisfy the constraints. Note that once an {@link org.modeshape.jcr.spi.index.provider.Filter.Results} isobtained, it may be called zero or more times but will always be closed.
@see IndexProvider#getIndex(String,String) @author Randall Hauch (rhauch@redhat.com)Arbitrary properties can be defined in the index properties files, and in particular, properties are used to record index statistics and the contructor type and values of various index objects.
The Index will apply methods on specially marked interfaces. Currently, the only interface supported is IndexConfigurable. Moreover, structures implementing java.io.Closeable will have their close method called when the Index is closed.
@author Craig Macdonald & Vassilis Plachouras
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|