WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Endpoint
Name:TextIndex
Description:add a search result into a lucene index
Id:TextIndex
Category:accessor
Identifier Syntax

TextIndex is an accessor using Active URI syntax with the following base identifiers:

Base
active:textIndex

and the following arguments: (for more details on argument passing details see here)

ArgumentRulesTypingDescription
operand
Mandatory
Representation (java.lang.Object)specification of item to index
config
Optional
Identifieroptional configuration
directory
Optional
Identifierfilesystem location of index
Request Verbs

The following verb is supported:

Verb
SOURCE
Response

The response representation of this accessor for SOURCE requests is unknown.

This accessor throws no documented exceptions.

Import Requirements

To use TextIndex accessor you must import the module urn:org:netkernel:text:search:core:

<import>
  <uri>urn:org:netkernel:text:search:core</uri>
</import>

Adds a single item with one or more fields to the index.

The endpoint returns back an XML document summarizing time taken in seconds and number of items added:

<indexResult>
  <time>0.001</time>
  <count>1</count>
</indexResult>

operand argument

The declarative index specification of the resource to be analyzed and/or added to the indexed. It consists of an item containing fields.

item

An item to be be indexed has the following form.

<item>
  <field index="ANALYZED" store="NO">
    <name>document</name>
    <uri>res:/test/docs/doc1.txt</uri>
  </field>
  <field index="ANALYZED" store="YES">
    <name>keywords</name>
    <value>this field is indexed</value>
  </field> ...any number of fields...
</item>

An item may contain any number of field entries. The format for a field must be as follows...

<field index="...an indexing option..." store="...a storage option...">
  <name>the Lucene index field name</name>
  <uri>URI of resource to index</uri> or
  <value>a text string value to index</value>
</field>

A field must specify a name - this is the Lucene index field name under which the item will be categorized in the indexed and is the identity used for targeting searches.

A field must specify one of uri or value.

  • uri - is the URI of the resource to be indexed. It will be read as a IReadableBinaryStream and will be analyzed but will not be stored. If this option is specified then the item will be added to the index with an accompanying index field with name "[ name ] URI" containing the value of uri.
  • value is a text string to be indexed.

index attribute

The index attribute options are capitalized strings and must be valid static fields on the Lucene Field.Index object.

For example

  • index="ANALYZED" - Index the tokens produced by running the field's value through the Analyzer.
  • index="NOT_ANALYZED" - Index the field's value without using an Analyzer, so it can be searched. As no analyzer is used the value will be stored as a single term. This is useful for unique Ids like product numbers.
  • index="NO" - Field is not indexed

If index is ommitted from a field the default is "ANALYZED".

store attribute

store attribute options are capitalized strings and must be valid static fields on the Lucene Field.Store object.

For example

  • store="NO" - do not store the content in the index.
  • store="YES" - store the content in the index to be returned with search hits.

If store ommitted from a field the default is "NO".

directory argument

An optional URI to the directory containing the Lucene index. If not specified the index directory will be taken from the configuration

config argument

An optional reference to the configuration to use. If not specified then the tools look for a local configuration resource located at res:/etc/SearchConfig.xml. If this is not found a default configuration is used.