WSO2 API Manager has Apache Solr based indexing for API documentation content. It provides both the API Publisher and Store a full-text search facility to search through the API documentation, and find the documents and related APIs. The search syntax is doc:keyword. The search criteria looks for the keyword in any word/phrase in the documentation content and returns both the matching documents and associated APIs.
The following media types have Apache Solr based indexers by default, which are configured using the
<Indexers> element in
- Text : text/plain
- PDF : application/pdf
- MS word : application/msword
- MS Powerpoint : application/vnd.ms-powerpoint
- MS Excel : application/vnd.ms-excel
- XML : application/xml
Writing a custom index
In addition to the default indexes, you can write your own indexer implementation and register it as follows:
Write a custom indexer.
The following is the sample indexer code.
Add the custom indexer JAR file to the
<Indexers>element in the
<API-M_HOME>/repository/conf/registry.xmlfile with the new indexer.
The content is indexed using this media type. For example,
The attributes of the above configuration are described below:
Java class name of the indexer.
A regular expression (regex) pattern to match the media type.
API-M profiles in which the indexer is available.
- Restart the server.
- Add the API documentation using the new media type and thereafter search some term in the documentation using the syntax (
You can now see how the documentation has got indexed according to the media type.