6.2. Categories

There is a categories editor written in Perl. You can get it in perl/cat_ed/ subdirectory of DataparkSearch installation.

Categories are similar to tag feature, but nested. So you can have one category inside another and so on.

Basic points:

You can also set up symlinks, e.g. categories that are actually links to other categories. link database field is used for that. In the symlink last two characters should be @@. In example above Moto->BMW is a link to Auto->BMW.

First notice that category in the server table is set to be 11 characters long. This means you can use a valid character to keep track of categories. If you are going to keep a category tree of any size, then I would suggest using the category editor. But anyways, here's how it works.

You can use either the tag column or the category column in the server for the same thing. Or you can categorize a site in two different ways. For example you could keep track of sites that are owned by a certain company and then categorize them as well. You could use the tag option to keep of ownership and use the category option for categories. When I explain the category option, it goes the same for the tag option.

A category can be broken down any way you choose. But for it to work with the category editor, I believe for now, you have to use two characters for each level. If you use the category editor you have the choice to use a hex number going from 0-F or a 36 base number going from 0-Z. Therefore a top-level category like 'Auto' would be 01. If it has a subcategory like 'Ford', then it would be 01 (the parent category) and then 'Ford' which we will give 01. Put those together and you get 0101. If 'Auto' had another subcategory named 'VW', then its id would be 01 because it belongs to the 'Ford' category and then 02 because it's the next category. So its id would be 0102. If VW had a sub category called 'Engine' then it's id would start at 01 again and it would get the 'VW' id 02 and 'Auto' id of 01, making it 010201.

If you want to search for sites under that category then you pass it cat=010201 in the url...so create a select box and give like that:

<OPTION value="01">AUTO
<OPTION value="0101">Ford

and so on...

Note: For dbmode cache you need to have the following section defined in your sections.conf file:

Section category 0 32 single
i.e. in overall you need to have the section 'category' defined with non-zero maximum length.

6.2.1. Category command

Category <string>

You may distribute documents between nested categories. Category is a string in hex number notation. You may have up to 6 levels with 256 members per level. Empty category means the root of category tree. Take a look into Section 6.2> for more information.

# This command means a category on first level:
Category AA
# This command means a category on 5th level:

6.2.2. CategoryIf command

CategoryIf <category> [Match|NoMatch] [NoCase|Case] [String|Regex] [loose] <section> <arg> [<arg> ... ]

Mark document by <category> category, if the value of section match arg pattern given. The meaning of first three optional parameters is exactly the same as for the Allow command (see Section 3.10.14>). Optional parameter loose specify to do not override the category value if it has been already set from server parameters.


CategoryIf 010F regex Title "JOB ID"

6.2.3. Loading categories table

When the command

CategoryTable mysql://user:pass@host/dbname/tablename[?charset=CHARSET]
is specified, indexer loads categories information from given tablename SQL-table. Check the structure of categories table in create/mysql/create.txt file. If there is no structure example for your database, take it as an example.

You may use several CategoryTable commands to load categories information from different tables. In such case, the values of rec_id field must be unique for all these tables.

6.2.4. FlushCategoryTable command

This command deletes all records from categories table. Use this command to delete outdated data before loading new data into categories table with CategoryTable commands.