Settings for crawling the data store
This page is generated by Machine Translation from Japanese.
Overview
You can crawl data sources such as databases and CSV in Fess . Here are required to store settings.
How to set up
How to display
In Administrator account after logging in, click menu data store.
As an example, the following table database named testdb MySQL, user name hoge, fuga password connection and the will to make it.
CREATE TABLE doc (
id BIGINT NOT NULL AUTO_INCREMENT,
title VARCHAR(100) NOT NULL,
content VARCHAR(255) NOT NULL,
latitude VARCHAR(20),
longitude VARCHAR(20),
versionNo INTEGER NOT NULL,
PRIMARY KEY (id)
);
Here the data is put something like the following.
INSERT INTO doc (title, content, latitude, longitude, versionNo) VALUES ('タイトル 1', 'コンテンツ 1 です.', '37.77493', ' -122.419416', 1);
INSERT INTO doc (title, content, latitude, longitude, versionNo) VALUES ('タイトル 2', 'コンテンツ 2 です.', '34.701909', '135.494977', 1);
INSERT INTO doc (title, content, latitude, longitude, versionNo) VALUES ('タイトル 3', 'コンテンツ 3 です.', '-33.868901', '151.207091', 1);
INSERT INTO doc (title, content, latitude, longitude, versionNo) VALUES ('タイトル 4', 'コンテンツ 4 です.', '51.500152', '-0.126236', 1);
INSERT INTO doc (title, content, latitude, longitude, versionNo) VALUES ('タイトル 5', 'コンテンツ 5 です.', '35.681382', '139.766084', 1);
Setting item
Parameter
Parameter settings example looks like the following.
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/testdb?useUnicode=true&characterEncoding=UTF-8
username=hoge
password=fuga
sql=select * from doc
Parameter is a “key = value” format. Description of the key is as follows.
driver | Driver class name |
URL | URL |
username | To connect to the DB user name |
password | To connect to the DB password |
SQL | Want to crawl to get SQL statement |
Table: For DB configuration parameter example
Script
Script configuration example looks like the following.
url="http://localhost/" + id
host="localhost"
site="localhost"
title=title
content=content
cache=content
digest=content
anchor=
contentLength=content.length()
lastModified=@jp.sf.fess.taglib.FessFunctions@formatDate(new java.util.Date(@System@currentTimeMillis()))
location=latitude + "," + longitude
latitude_s=latitude
longitude_s=longitude
Parameter is a “key = value” format. Description of the key is as follows.
Side of the value written in OGNL. Close the string in double quotation marks. Access in the database column name, its value.
URL | URLs (links appear in search results) |
host | Host name |
site | Site pass |
title | Title |
content | Content (string index) |
cache | Content cache (not indexed) |
Digest | Digest piece that appears in the search results |
anchor | Links to content (not usually required) |
contentLength | The length of the content |
lastModified | Content last updated |
Table: Script settings
Driver
To connect to the database driver is needed. keep the jar file in webapps/fess/WEB-INF/cmd/lib.
Display parameters
Set the following in the webapps/fess/WEB-INF/classes/app.dicon if you see the item value, such as latitude_s in the search results. After adding to $ {doc.latitude_s}, searchResults.jsp;
<component name="queryHelper" class="jp.sf.fess.helper.impl.QueryHelperImpl">
<property name="responseFields">new String[]{"id", "score", "boost",
"contentLength", "host", "site", "lastModified", "mimetype",
"tstamp", "title", "digest", "url", "latitude_s","longitude_s" }</property>
</component>