# How to Configure a Full-text Search

With a full-text search, you can search for words and phrases throughout all text documents in your 4ALLPORTAL.

Every time you import a document such as MS Word or PDF into the DAM, native preview processor text_anaylse automatically extracts the documents' text and writes it to table idnt_mkp_txt in the SQL database.

All you need to do to search the contents of this table is implement a new field renderer in your default search renderer.

# Search Renderer Configuration

We recommend adding a full-text search by using a change configuration. That method allows you to modify the 4ALLPORTAL as required, but avoids collisions in the default.4aprenderer configuration when upgrading the system. Otherwise, it is also possible to place a full-text search just below a custom search renderer configuration.

  1. Go to folder custom/modules/file/object_renderer/search and open or create a new change configuration file default.4aprenderer_c.

  2. Add the following change configuration to file default.4aprenderer_c. The full-text search field will be placed in the first <group_renderer> section at the last position after existing default section <field_renderer_list>:

<changes extends="search/default">
    <change xpath="//search_renderer/group_renderer_list/group_renderer[1]/field_renderer_list" type="add" at="last">
        <field_renderer>
            <label>L-FILE-CE_FILE_FULLTEXT_SEARCH</label>
            <placeholder>L-FILE-CE_FILE_FULLTEXT_SEARCH-PROMPT</placeholder>
            <comparator>MATCH</comparator>
            <operator>AND</operator>
            <field_renderer_attributes>
                <entry key="visual_type">single_line</entry>
            </field_renderer_attributes>
            <search_fields>
                <search_field>
                    <type>CEText</type>
                    <name>idnt_mkp_txt_file_id.text</name>
                </search_field>
            </search_fields>
        </field_renderer>
    </change>
</changes>        

If you want to place the full-text search field in another group- or search renderer section, you can modify this change as you need.

Please note: On a 3.x system, the comparator MATCH was not yet supported.

Learn more about changes and their elements here (opens new window).

# Label Translation

Translate your label key (and optional prompt text or tooltip) via admin snap-in Translation Studio or in your file system in file general.properties in folder custom/modules/file/locale/en_US, for example like this:

L-FILE-CE_FILE_FULLTEXT_SEARCH=Full-text search
L-FILE-CE_FILE_FULLTEXT_SEARCH-PROMPT=Search terms in Word, PDF, etc.

Learn more about labels and their translations here (opens new window).

# Example

In the following example we place the full-text search field below our comprehensive search in the existing default.4aprenderer. The first passage will therefore look like this:

<?xml version="1.0" encoding="UTF-8" ?>
<search_renderer>
    <label_placement>top</label_placement>
    <group_renderer_list>
        <group_renderer>
            <type>foldable</type>
            <label>L-FILE-DEFAULT_SEARCH_GROUP</label>

            <field_renderer_list>

                <field_renderer>
                    <label>L-FILE-GLOBAL_FILE_SEARCH</label>
                    <placeholder>L-FILE-GLOBAL_FILE_SEARCH-PROMPT</placeholder>
                    <comparator>LIKE</comparator>
                    <wildcard_settings>
                        <user>true</user>
                        <before>true</before>
                        <after>true</after>
                    </wildcard_settings>
                    <operator>OR</operator>
                    <search_fields>
                        <search_field>
                            <name>friendlyname</name>
                        </search_field>
                        <search_field>
                            <name>mimetype</name>
                        </search_field>
                    </search_fields>
                </field_renderer>

                <field_renderer>
                    <label>L-FILE-CE_FILE_FULLTEXT_SEARCH</label>
                    <placeholder>L-FILE-CE_FILE_FULLTEXT_SEARCH-PROMPT</placeholder>
                    <comparator>MATCH</comparator>
                    <operator>AND</operator>
                    <field_renderer_attributes>
                        <entry key="visual_type">single_line</entry>
                    </field_renderer_attributes>
                    <search_fields>
                        <search_field>
                            <type>CEText</type>
                            <name>idnt_mkp_txt_file_id.text</name>
                        </search_field>
                    </search_fields>
                </field_renderer>

                <!-- some more stuff -->

            </field_renderer_list>
        </group_renderer>
    </group_renderer_list>
</search_renderer>

Translation of the label keys in our custom file general.properties:

L-FILE-CE_FILE_FULLTEXT_SEARCH=Full-text Search
L-FILE-CE_FILE_FULLTEXT_SEARCH-PROMPT=Search for terms in Word, pdf, etc.

The result in the GUI looks like this:

Your users can add several comparators to specify their search, e.g. when looking for an exact word or phrase:

Comparator Search entry Search result
none apple pear at least one of both words must be present in the document(s)
+ +apple +pear
+apple pear
apple AND pear must be present in the document(s)
apple must be present in the document(s), pear is optional
- -apple -pear
-apple +pear
apple AND pear must not be present in the document(s)
apple must not be present in the document(s), pear must be
( ) +(apple pear)
-(apple pear)
apple OR pear must be present in the document(s)
apple AND pear must not be present in the document(s)
serves for logical grouping of search values
* appl* wildcard character (works similar to "LIKE"), may only be placed at the end of the word
" " "apple pear" this exact phrase must be present in the document(s), e.g. "apple pear", but also "apple, pear"

Please note: Letters are not handled case sensitive. Lowercase letters ("apple") are identical to uppercase letters ("Apple").

# Supported File Formats

The preview processor will automatically extract the following media types with their dependent file types:

Media type Application Formats
text Microsoft Word (up to latest version) doc, docx, docm, dot, dotx, dotm
table Microsoft Excel (up to latest version) xls, xlsx, xlt, xltx, xlsm, xltm, xlsb
presentation Microsoft PowerPoint (up to latest version) ppt, pptx, pot, potx, pptm, ppsm, potm
text OpenDocument text odt
table OpenDocument tables ods
presentation OpenDocument presentation odp
pdf PDF - Portable Document Format pdf
text Plain text txt, rtf
Request missing documentation