Spring + lire with image search configuration

Source: Internet
Author: User
Tags create index

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.