lucene/sandbox/projects/appex/GETTING STARTED.txt

14 lines
944 B
Plaintext
Raw Normal View History

The fastest way to get started is to instantiate FSDataSource, passing a File or
Directory into the constructor. Then in SearchIndexer, invoke indexDataSource and
pass in the FSDataSource in as a parameter. The other argument of indexDataSource,
customFields, is for declaring what are the types of the fields you wish indexed.
It's an optional argument.
Now you might want to try writing your own DataSource by writing a class which
implements the DataSource interface. The only method you need to implement in the
DataSource interface is the getData method which returns an array of Maps.
From the javadoc of this method, "Each map represents a document to be indexed.
The key:value pairs of the map is the metadata of the document.".
That should be pretty self-explanatory. What the framework essentially does is
convert all keys in the map as Fields, and the value of the keys becoming the
value of the Fields. It's that simple!