Configuration

From OpenCms Wiki
Revision as of 21:08, 27 June 2007 by Pam (Talk | contribs)
Jump to: navigation, search

OpenCms comes with a built in search index for the online and offline projects. Additional search indices can be created but have to be done through editing the XML config file opencms-search.xml.

Make a backup before touching these config files!!! OpenCms will not even run if there is a problem in them.

A additional search index section would go in the indexes section of opencms-search.xml, and would look something like this:

<index>
   <name>myproject</name>
   <rebuild>auto</rebuild>
   <project>Online</project>
   <locale>en</locale>
   <sources>

Invalid language.

You need to specify a language like this: <source lang="html">...</source>

Supported languages for syntax highlighting:

actionscript, ada, apache, applescript, asm, asp, autoit, bash, blitzbasic, bnf, c, c_mac, caddcl, cadlisp, cfdg, cfm, cpp, cpp-qt, csharp, css, d, delphi, diff, div, dos, eiffel, fortran, freebasic, gml, groovy, html4strict, idl, ini, inno, io, java, java5, javascript, latex, lisp, lua, matlab, mirc, mpasm, mysql, nsis, objc, ocaml, ocaml-brief, oobas, oracle8, pascal, perl, php, php-brief, plsql, python, qbasic, reg, robots, ruby, sas, scheme, sdlbasic, smalltalk, smarty, sql, tcl, text, thinbasic, tsql, vb, vbnet, vhdl, visualfoxpro, winbatch, xml, z80

   </sources>
</index>

You also need to create an index source to go along with it, it goes in the indexsources section of the XML:

<indexsource>
   <name>source1</name>
   <indexer class="org.opencms.search.CmsVfsIndexer"/>
   <resources>
        <resource>/sites/mysite/</resource>
   </resources>
   <documenttypes-indexed>
        <name>xmlpage</name>
        <name>xmlcontent</name>
        <name>text</name>
        <name>pdf</name>
        <name>rtf</name>
        <name>html</name>
        <name>msword</name>
        <name>msexcel</name>
        <name>mspowerpoint</name>
        <name>image</name>
        <name>generic</name>
   </documenttypes-indexed>
</indexsource>

And if you want any custom document type, you'll have to add that to the documenttypes section. You may also have to create a CmsDocumentClass in Java for it, or find one it can share. Here is an existing sample:

<documenttype>
    <name>rtf</name>
    <class>org.opencms.search.documents.CmsDocumentRtf</class>
    <mimetypes>
         <mimetype>text/rtf</mimetype>
         <mimetype>application/rtf</mimetype>
    </mimetypes>
    <resourcetypes>
         <resourcetype>binary</resourcetype>
         <resourcetype>plain</resourcetype>
    </resourcetypes>
</documenttype>
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox