Fields and methods of the jala.IndexManager class.
Constructs a new IndexManager object.
parameters
| String | name | The name of the index, which is the name of the directory the index already resides or will be created in. |
| helma.File | dir | The base directory where this index's directory is already existing or will be created in. If not specified a RAM directory is used. |
| String | lang | The language of the documents in this index. This leads to the proper Lucene analyzer being used for indexing documents. |
methods
- getIndex()
- setStatus(s)
- getQueue()
- getName()
- setIdFieldname(name)
- start()
- stop()
- log(level, msg)
- add(doc)
- remove(id)
- optimize()
- search(query, filter, sortFields)
- parseQuery(queryStr, fields, boostMap)
- parseQueryFilter(query)
see
Creates a new Job instance.
parameters
| Number | id | The Id of the job |
| Number | type | The type of job, which can be either jala.IndexManager.Job.ADD, jala.IndexManager.Job.REMOVE or jala.IndexManager.Job.OPTIMIZE. |
| Object | data | The data needed to process the job. |
properties
- Number type
- Number errors
- Date createtime
see
Constant defining the maximum number of tries to add/remove
an object to/from the underlying index.
Constant defining normal mode of this index manager.
Constant defining rebuilding mode of this index manager.
The type of the job
The data needed to process this job. For adding jobs this property
must contain the {@link helma.Search.Document} instance to add to
the index. For removal job this property must contain the unique identifier
of the document that should be removed from the index. For optimizing
jobs this property is null.
An internal error counter which is increased whenever processing
the job failed.
see
The date and time at which this job was created.
Constant defining an add job
Constant defining a removal job
Constant defining an optimizing job
Methods
Returns the directory of the underlying index
returns
| The directory of the underlying index |
Returns the underlying index.
returns
| The index this queue is working on. |
Returns the status of this manager.
returns
| The status of this index manager. |
see
Modifies the status of this manager, which has implications
on how index modifying jobs are handled. If the status
is {@link #REBUILDING}, all jobs are queued until the status
is set back to {@link #NORMAL}.
parameters
| Number | s | The new status of this manager. |
see
Returns the name of the index manger, which
is equal to the name of the underlying index
returns
| The name of the index manager |
Returns the name of the field containing the unique identifier
of document objects in the index wrapped by this IndexManager.
Defaults to "id".
returns
| The name of the id field in the index |
see
Sets the name of the field containing the unique identifier
of document objects in the index wrapped by this IndexManager.
parameters
| name |
see
Returns true if the underlying index is currently optimized.
returns
| True in case the index is optimized, false otherwise. |
Returns true if the underlying index is currently rebuilding.
returns
| True in case the index is rebuilding, false otherwise. |
Starts the IndexManager worker thread that processes the job queue
Stops this IndexManager instance. This function waits for 10 seconds
maximum for the worker thread to stop.
returns
| True if the worker thread stopped successfully, false otherwise |
Returns true if this IndexManager instance is running
returns
| True if this IndexManager instance is running, false otherwise. |
Helper function that prefixes every log message with
the name of the IndexManager.
parameters
| String | level | An optional logging level. Accepted values |
| String | msg | The log message are "debug", "info", "warn" and "error". |
Queues the document object passed as argument for addition to the underlying
index. This includes that all existing documents with the same identifier will
be removed before the object passed as argument is added.
parameters
| helma.Search.Document | doc | The document object that should be added to the underlying index. |
returns
| True if the job was added successfully to the internal queue, false otherwise. |
see
Queues the removal of all index documents whose identifier value ("id" by default)
matches the number passed as argument.
parameters
| Number | id | The identifier value |
returns
| True if the removal job was added successfully to the queue, false otherwise. |
Queues the optimization of the underlying index. Normally there is no need
to call this method explicitly, as the index will be optimized after all
queued jobs have been processed.
returns
| True if the optimizing job was added, false otherwise, which means that there is already an optimizing job waiting in the queue. |
Searches the underlying index using the searcher of this index manager
parameters
| helma.Search.Query, org.apache.lucene.search.Query | query | The query to execute. Can be either an instance of helma.Search.Query, or an instance of org.apache.lucene.search.Query |
| helma.Search.QueryFilter, org.apache.lucene.search.Filter | filter | An optional query filter |
| Array | sortFields | An optional array containing org.apache.lucene.search.SortField instances to use for sorting the result |
returns
| A HitCollection containing the search results |
Parses the query string passed as argument into a lucene Query instance
parameters
| String | queryStr | The query string to parse |
| Array | fields | An array containing the names of the files to search in |
| Object | boostMap | An optional object containing properties whose name denotes the name of the field to boost in the query, and the value the boost value. |
returns
| The query |
Parses the query passed as argument and returns a caching filter. If an array
with more than one query strings is passed as argument, this method constructs
a boolean query filter where all queries in the array must match.
parameters
| String, Array | query | Either a query string, or an array containing one or more query strings |
returns
| A caching query filter |
