1. Configure the Java environment:
Apt-get Install update
Apt-get Install Default-jre
Apt-get Install DEFAULT-JDK
Configuring java_home Environment Variables
View Java installation path: Update-alternatives--config java
VI /etc/environment
At the end of the file add:
Java_home= "/usr/lib/jvm/java-7-oracle"
2. Configuration file Modification
configuration file directory:src/main/resources
application.properties
Spring. profiles.active
Specify to use Which of the appplication-xxx.properties is the spring configuration file, the development is using swap as the default, Publish is generally used on the official server
page.defaultpagesize
Interface number of items returned by API
Score.max
The most distant commodity value in the interface, the higher the value, the less similar, the general 10-15 suitable
Spring.datasource.xxx.xxx
Spring Data Source configuration, database-related parameters (database connection modified in the following configuration file)
Picture index file path, please confirm read Write permission
application-xxx.properties
Local.lire.basePath
Picture index file path, please confirm read Write permission
Local.db.xxx.url
database Server connection string ( IP Port Database )
Local. Db.xxx.username
Database Server user Name
Local.db.xxx.password
Database server password
database entity class modification
file directory: Src/main/java/bean /sg
Typically a table corresponds to a class
Zproduct.java
List of products that need to generate pictures
table name corresponding to @table class
@Id A primary key field in a table name
@Column Field name
database Operation class modification
file directory :src/main/java/dao/sg
Zproductdao
The operation of the database is in that class, generally corresponding to the entity class one by one
@Query Query Statements
@Param variable arguments in a query statement
Getallproductid Read all the product IDs
Getnewproduct Read all new inbound commodity IDs (items greater than the last-read maximum ID )
The above main configuration database connection and table as well as ID, picture address field
3. Create index Store directory to ensure writable
Lire.indexpath = ${LOCAL.LIRE.BASEPATH}/INDEX-TK
Lire.index.all= ${local.lire.basepath}/index-all
lire.index.tk = ${LOCAL.LIRE.BASEPATH}/INDEX-TK
LIRE.INDEX.BK = ${LOCAL.LIRE.BASEPATH}/INDEX-BK
4. Compile with Gradlew
./gradlew Jar
Copy Spring-lire/build/libs/spring-lire-0.0.1.jar to Spring-lire/lib after compiling
5. Create an index
Spring-lire/bin/start.sh #启动服务
Spring-lire/bin/cron_sync.sh #生成所有索引
Spring-lire/bin/cron_sync_add.sh #生成增量索引
Spring + lire with image search configuration