Go to the first, previous, next, last section, table of contents.


Hook Fulcrum configuration file

`serial (mandatory)'
The unique identifier used for fulcrum fields. We advise to use 230. Each fulcrum field generated from the database/tables specification will be associated with an identifier in the range <serial> and up.
`chunksize (mandatory)'
The maximum number of updates or deletions that can be done with fulcrum. We advise to use 1000. This is mainly to prevent SQL query buffer overflow for tables that contain a lot of records.
`<sql database> (nested)'
All other keywords at the top level of the configuration file are interpreted as SQL database names. The nested configuration instructions describe the coupling between this database and the fulcrum search engine.
`params (mandatory, nested)'
Database wide parameters.
`table (mandatory)'
The name of the fulcrum table that will contain the indexed data.
`tables (mandatory, nested)'
All the keywords are SQL tablenames.
`<sql tablename> (mandatory, nested)'
`params (optional, nested)'
`where (optional)'
A where clause applied on the SQL table that will limit the scope of records taken in account during indexing.
`merge (optional, nested)'
Import fields values from the designated table for every indexed record of the current table. The designated table must have an entry in database/table and the listed fields must be mapped to fulcrum fields.
`table (mandatory)'
An SQL table linked to the current table, See section Relational constraints.
`fields (mandatory)'
The list of fields from the table that must be imported.
`fields (mandatory, nested)'
All the keywords must be valid fieldnames of the SQL table.
`<sql fieldname>'
`field'
The name of the fulcrum field that will contain a copy of the value from the SQL field.
`query (mandatory, nested)'
Specifications to build the full text query.
`table (mandatory)'
The name of the fulcrum table to use for the query.
`divide_or (optional)'
The division factor applied to or query in each group.
`extract (mandatory)'
The list of fields that contains the rowid of the records that are to be retrieved from the SQL database. Those fields all begin with r_. If an order clause is present must also contain all the fields mentioned in the order clause (due to fulcrum limitations).
`relevance (mandatory)'
The relevance method used. If an order clause is present must also contain all the fields mentioned in the order clause (due to fulcrum limitations).
`order (optional)'
Order by clause.
`constraint_weight (optional)'
If a constraint matches in a given group, give it the weight mentioned in here.
`templates (optional, nested)'
Re-map each automatically generated sub template name.
`groups (mandatory, nested)'
`<group number> (mandatory nested)'
Each group number is taken in numerical order to build the query.
`where (optional)'
The record must match the where condition in addition to the generated full text query.
`weight (mandatory)'
Records matching the literal or all the words from the query will have this weight. Records matching at least one word from the question will have this weight divided by the divide_or parameter.
`constraint (optional)'
If specified list the fields on which a constraint may be applied.
`fields (mandatory)'
The list of fulcrum table fields that will be searched during the full text search process.

The general structure of the file is as follows:

#
# Link fulcrum with SQL database
#
#
# Fulcrum field numbering start from serial and up (suggested 230)
#
serial = <number> 
#
# How many fulcrum deletions/update can be done in one
# request (suggested 1000)
#
chunksize = <number>
#
# SQL base name
#
<sql database>
    #
    # General parameters for base
    #
    params
        #
        # Name of the fulcrum table 
        #
        table = <fulcrum tablename>
    end
    #
    # SQL tables mapping
    #
    tables
        <sql tablename>
            params
                #
                # Only records matching this where
                # clause will be inserted
                #
                where = <sql where clause>
                #
                # Merge part of a linked row into
                # each entry. Link must be defined in
                # relations.spec.
                #
                merge   
                    table = <sql tablename>
                    fields = <sql fieldname,sql fieldname,...>
                end
            end
            fields
                <sql fieldname>
                    field = <fulcrum fieldname>
                end
                ...
            end
        end
        ...
    query
        params
            #
            # Name of the fulcrum table 
            #
            table = <fulcrum tablename>
            #
            # Reduce factor for or'ed terms (suggested 100)
            #
            divide_or = <number>
            #
            # When a row is found, retrieve only these fields
            #
            extract = <fulcrum fieldname>,<fulcrum fieldname>,...
            #
            # Relevance method
            #
            relevance = relevance(<fulcrum relevance>) as rel,
                        <fulcrum orderby fields>
            #
            # When querying the order by clause is order
            #
            order = <fulcrum orderby>
            #
            # If a constraint is matched, apply this weight 
            # (suggested 1000)
            #
            constraint_weight = <number>
            #
            # Map table names to template names
            #
            templates
                <sql table,sql table,...> = <template basename>
                ...
            end
        end
        groups
            <group number>
                where = <fulcrum where clause>
                weight = <number>
                constraint = <constraint re>
                fields = <fulcrum fields>
            end
            ...
        end
    end
end

Here is a complete example:

#
# Link fulcrum with SQL database
#
#
# Fulcrum field numbering start from serial and up
#
serial = 230
#
# How many deletions/update can be done in one request
#
chunksize = 1000
#
# Mysql base name
#
interbat
    #
    # General parameters for base
    #
    params
        #
        # Name of the fulcrum table 
        #
        table = intersmall
    end
    #
    # Mysql tables mapping
    #
    tables
        societe
            params
                #
                # Only records matching this where
                # clause will be inserted
                #
                where = find_in_set('interbat', typesociete) 
            end
            fields
                typesociete
                    field = so_typesociete
                end
                nomaffiche
                    field = so_nomaffiche
                end
                raisonsociale
                    field = so_raisonsociale
                end
                raisonsocialecomplementaire
                    field = so_raisonsocialec
                end
                sigle
                    field = so_sigle
                end
                motscles
                    field = so_motscles
                end
                descriptif
                    field = so_descriptif
                end
                descriptiflong
                    field = so_descriptiflong
                end
                activite
                    field = so_activite
                end
                url
                    field = so_url
                end
                mail
                    field = so_mail
                end
                adresse
                    field = so_adresse
                end
                codepostal
                    field = so_codepostal
                end
                ville
                    field = so_ville
                end
                pays
                    field = so_pays
                end
                tel
                    field = so_tel
                end
            end
        end
        start
            params
                #
                # Only records matching this where
                # clause will be inserted
                #
                where = disabled = 'no'
            end
            fields
                descriptif
                    field = st_descriptif
                end
                url
                    field = st_url
                end
                debut
                    field = st_debut
                end
                fin
                    field = st_fin
                end
            end
        end
        personne
            params
                #
                # Only records matching this where
                # clause will be inserted
                #
                where = publiable = 'yes'
                #
                # Merge part of a linked row into
                # each entry. Link must be defined in
                # relations.spec
                #
                merge   
                    table = societe
                    fields = typesociete
                end
            end
            fields
                nom
                    field = pe_nom
                end
                url
                    field = pe_url
                end
                mail
                    field = pe_mail
                end
                fonction
                    field = pe_fonction
                end
                adresse
                    field = pe_adresse
                end
                codepostal
                    field = pe_codepostal
                end
                ville
                    field = pe_ville
                end
                pays
                    field = pe_pays
                end
                tel
                    field = pe_tel
                end
            end
        end
        produitsnouveaux
            params
                #
                # Only records matching this where
                # clause will be inserted
                #
                # where = 
            end
            fields
                texte
                    field = pn_texte
                end
                nom
                    field = pn_nom
                end
                url
                    field = pn_url
                end
                debut
                    field = pn_debut
                end
                fin
                    field = pn_fin
                end
            end
        end
        marque
            params
                #
                # Only records matching this where
                # clause will be inserted
                #
                # where = 
                #
                # Merge part of a linked row into
                # each entry. Link must be defined in
                # relations.spec
                #
                merge   
                    table = societe
                    fields = typesociete
                end
            end
            fields
                marque
                    field = ma_marque
                end
                descriptif
                    field = ma_descriptif
                end
            end
        end
    end
    query
        params
            #
            # Name of the fulcrum table 
            #
            table = interall
            #
            # Reduce factor for or'ed terms
            #
            #divide_or = 100
            #
            # When a row is found, retrieve only these fields
            #
            extract = r_societe,r_marque
            #
            # Relevance method
            #
            relevance = relevance('2:2') as rel,ma_marque
            #
            # When querying the order by clause is order
            #
            order = rel desc,ma_marque
            #
            # If a constraint is matched, apply this weight
            #
            constraint_weight = 1000
            #
            # Map table names to template names
            #
            templates
                societe,start = start
                marque,societe = marquebatibase
                personne,societe = personnebatibase
                produitsnouveaux,societe = produitsnouveaux
                societe = societebatibase
            end
        end
        groups
            1
                where = so_typesociete contains 'interbat' weight 0
                weight = 900
                constraint = so_.*
                fields = so_raisonsociale,so_sigle,so_motscles
            end
            2
                where = so_typesociete contains 'interbat' weight 0
                weight = 900
                constraint = ma_.*
                fields = ma_marque,ma_descriptif
            end
            3
                where = (pn_debut < now() and pn_fin > now())
                weight = 800
                constraint = pn_.*
                fields = pn_nom,pn_texte,pn_url
            end
            4
#               where = (st_debut < now() and st_fin > now())
                weight = 700
                constraint = st_.*
                fields = st_url,st_descriptif
            end
            5
                weight = 700
                # st_url,ho,pa,tx
                constraint = (ho|pa|tx|e_text)
                fields = e_text
            end
            6
                where = so_typesociete contains 'batibase' weight 0
                weight = 130
                constraint = so_.*
                fields = so_raisonsociale,so_sigle,so_motscles
            end
            7
                where = so_typesociete contains 'batibase' weight 0
                weight = 130
                constraint = ma_.*
                fields = ma_marque,ma_descriptif
            end
            8
                weight = 50
                constraint = so_.*
                fields = so_url,so_mail,so_adresse,so_codepostal
            end
            9
                weight = 50
                constraint = pe_.*
                fields = pe_nom,pe_url,pe_mail,pe_fonction,pe_adresse
            end
        end
    end
end


Go to the first, previous, next, last section, table of contents.