Contents
Table of Contents |
---|
Use this page to share code that you have developed for Trafodion and that could be useful for others. This could include, but is not restricted to:
...
The source code can be downloaded from https://github.com/esgyn/code-examples/tree/master/src/main/cpp/FilterProg.
Text Search using Lucene
Lucene is an Apache project written in Java that provides text indexing and searching capabilities. In terms of function, the analogy for this particular use case is SQL's "LIKE" predicate (but Lucene offers more capabilities). This TMUDF shows the basics of how to use those APIs. A typical text index/search scenario involves many "documents" with a search result consisting of documents that match the search query. For this UDF, indexing and matching is made row-by-row, that is, the index represents just the current row. Also, an in-memory directory class is used rather than one on disk.
This example was developed with Lucene 5.5.2, a version using Java 7. Later Lucene releases (> 6.x) use Java 8 and beyond.
The java source can be copied from: https://github.com/esgyn/code-examples/tree/master/src/main/java/org/trafodion/examples/udrs/udfs/table_valued/lucene.
Manageability
Tools
SQL Scripts and Queries
Miscellaneous