Liferay:索引的配置

索引是全文检索的依据。Liferay中集成了 Lucene

在配置文件中不仅要设置lucene的信息,还要配置索引的做成信息。

配置文件的lucene信息如下:


##
## Lucene Search
##

    #
    # Set the limit for results used when performing index searches that are
    # subsequently filtered by permissions.
    #
    index.filter.search.limit=5000

    #
    # Set this to true if you want to avoid any writes to the index. This is
    # useful in some clustering environments where there is a shared index and
    # only one node of the cluster updates it.
    #
    index.read.only=false

    #
    # Set this to true if you want to index your entire library of files on
    # startup. This property is available so that automated test environments
    # index on startup. Do not set this to true on production systems or else
    # your index will be indexed on every startup.
    #
    index.on.startup=false

    #
    # Set this to true to add a delay before indexing on startup. A delay may be
    # necessary if a lot of plugins need to be loaded and reindexed. This
    # property is only valid if "index.on.startup" is set to true.
    #
    index.on.startup.delay=60

    #
    # Set this to true if you want to index your entire library of files after
    # an upgrade. Only set this property to false if you are running a small
    # upgrade and you do not need to reindex everything.
    #
    index.on.upgrade=true

    #
    # Set this to true if you want the indexing on startup to be executed on a
    # separate thread to speed up execution.
    #
    index.with.thread=true

    #
    # Designate whether Lucene stores indexes in a database via JDBC, file
    # system, or in RAM.
    #
    #lucene.store.type=jdbc
    lucene.store.type=file
    #lucene.store.type=ram

    #
    # Lucene's storage of indexes via JDBC has a bug where temp files are not
    # removed. This can eat up disk space over time. Set this to true to
    # automatically clean up the temporary files regularly. See LEP-2180.
    #
    #lucene.store.jdbc.auto.clean.up.enabled=true

    #
    # Set the interval on which the lucene automatic clean up is set run. The
    # value is set in one minute increments.
    #
    lucene.store.jdbc.auto.clean.up.interval=1440

    #
    # Set the JDBC dialect that Lucene uses to store indexes in the database.
    # This is only referenced if Lucene stores indexes in the database. Liferay
    # will attempt to load the proper dialect based on the URL of the JDBC
    # connection. For example, the property "lucene.store.jdbc.dialect.mysql" is
    # read for the JDBC connection URL "jdbc:mysql://localhost/lportal".
    #
    lucene.store.jdbc.dialect.db2=org.apache.lucene.store.jdbc.dialect.DB2Dialect
    lucene.store.jdbc.dialect.derby=org.apache.lucene.store.jdbc.dialect.DerbyDialect
    lucene.store.jdbc.dialect.hsqldb=org.apache.lucene.store.jdbc.dialect.HSQLDialect
    lucene.store.jdbc.dialect.jtds=org.apache.lucene.store.jdbc.dialect.SQLServerDialect
    lucene.store.jdbc.dialect.microsoft=org.apache.lucene.store.jdbc.dialect.SQLServerDialect
    lucene.store.jdbc.dialect.mysql=org.apache.lucene.store.jdbc.dialect.MySQLDialect
    #lucene.store.jdbc.dialect.mysql=org.apache.lucene.store.jdbc.dialect.MySQLInnoDBDialect
    #lucene.store.jdbc.dialect.mysql=org.apache.lucene.store.jdbc.dialect.MySQLMyISAMDialect
    lucene.store.jdbc.dialect.oracle=org.apache.lucene.store.jdbc.dialect.OracleDialect
    lucene.store.jdbc.dialect.postgresql=org.apache.lucene.store.jdbc.dialect.PostgreSQLDialect

    #
    # Set the directory where Lucene indexes are stored. This is only referenced
    # if Lucene stores indexes in the file system.
    #
    lucene.dir=${liferay.home}/data/lucene/

    #
    # Input a class name that extends
    # com.liferay.portal.search.lucene.LuceneFileExtractor. This class is called
    # by Lucene to extract text from complex files so that they can be properly
    # indexed.
    #
    lucene.file.extractor=com.liferay.portal.search.lucene.LuceneFileExtractor

    #
    # The file extractor can sometimes return text that is not valid for Lucene.
    # This property expects a regular expression. Any character that does not
    # matche the regular expression will be replaced with a blank space. Set an
    # empty regular expression to disable this feature.
    #
    lucene.file.extractor.regexp.strip=
    #lucene.file.extractor.regexp.strip=[\\d\\w]

    #
    # Set the default analyzer used for indexing and retrieval.
    #
    #lucene.analyzer=org.apache.lucene.analysis.br.BrazilianAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.cjk.CJKAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.cz.CzechAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.nl.DutchAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.fr.FrenchAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.de.GermanAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.KeywordAnalyzer
    #lucene.analyzer=org.apache.lucene.index.memory.PatternAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.PerFieldAnalyzerWrapper
    #lucene.analyzer=org.apache.lucene.analysis.ru.RussianAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.SimpleAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.snowball.SnowballAnalyzer
    lucene.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.StopAnalyzer
    #lucene.analyzer=org.apache.lucene.analysis.WhitespaceAnalyzer

    #
    # Set how often index updates will be committed. Set the batch size to
    # configure how many consecutive updates will trigger a commit. If the value
    # is 0, then the index will be committed on every update. Set the time
    # interval in milliseconds to configure how often to commit the index. The
    # time interval is not read unless the batch size is greater than 0 because
    # the time interval works in conjunction with the batch size to guarantee
    # that the index is committed after a specified time interval. Set the time
    # interval to 0 to disable committing the index by a time interval.
    #
    lucene.commit.batch.size=0
    lucene.commit.time.interval=0

    #
    # Set Lucene's buffer size in megabytes. Higher numbers mean indexing goes
    # faster but uses more memory.
    #
    lucene.buffer.size=16

    #
    # Set Lucene's merge factor. Higher numbers mean indexing goes faster but
    # uses more memory. The default value from Lucene is 10. This should never
    # be set to a number lower than 2.
    #
    lucene.merge.factor=10

    #
    # Set how often to run Lucene's optimize method. Optimization speeds up
    # searching but slows down writing. Set this property to 0 to always
    # optimize. Set this property to an integer greater than 0 to optimize every
    # X writes.
    #
    lucene.optimize.interval=100

    #
    # Set this to true if you want the portal to replicate an index write across
    # all members of the cluster. This is useful in some clustered environments
    # where you wish each server instance to have its own copy of the Lucene
    # search index. This is only relevant when using the default Lucene indexing
    # engine.
    #
    lucene.replicate.write=false


Liferay的全文检索的portlet中默认会检索很多东西。配置如下:

##
## Search Portlet
##

    #
    # Set any of these to false to disable the portlet from being searched by
    # the Search portlet.
    #
    com.liferay.portlet.blogs.util.BlogsOpenSearchImpl=true
    com.liferay.portlet.bookmarks.util.BookmarksOpenSearchImpl=true
    com.liferay.portlet.calendar.util.CalendarOpenSearchImpl=true
    com.liferay.portlet.directory.util.DirectoryOpenSearchImpl=true
    com.liferay.portlet.documentlibrary.util.DLOpenSearchImpl=true
    com.liferay.portlet.imagegallery.util.IGOpenSearchImpl=true
    com.liferay.portlet.journal.util.JournalOpenSearchImpl=true
    com.liferay.portlet.messageboards.util.MBOpenSearchImpl=true
    com.liferay.portlet.wiki.util.WikiOpenSearchImpl=true

什么Liferay中的blog,论坛,wiki,图片库,字典等都会被检索。

在系统中如果我们只想检索固定的portlet的时候,也为了提高检索效率,把上面的这些设置设置为false就可以了。


Liferay的效率一直 是一个比较突出的问题,随着服务器本身性能的提高,能够解决一大部分问题,但如果能避免系统做很多无用功的话,效率会更上一层楼。

这必须要吃透配置文件,设置恰当的参数。把不要的功能屏蔽掉最好。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值