Tuesday, July 19, 2016

Add documents with different media types and search content of them / Search documents by passing part of key word - WSO2 API Manager

API Manager default document search implementation will work only with registry stored document content files with the media types defined in registry.xml under tag as below.

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


Therefore documents added through the url will not work as that type doesn't have stored document content in registry. As a workaround we can add .jag/.html document files to the registry as API documents, then we need to write custom indexers for those media types and update the registry.xml file with those indexers.

For htmls you may use already available xml indexer as its almost same to xml.

<indexer class="org.wso2.carbon.apimgt.impl.indexing.indexer.XMLIndexer" mediaTypeRegEx="application/xml" profiles ="default,api-store,api-publisher"/>



Also when you search part of the string contained in text you may use following search query for that.  Having * symbol at start and end will help you to search documents which contains that part in any word.

doc:*part_of_text*

No comments:

Post a Comment