Skip to content

alogic-xscript-lucene是基于xscript2.0的lucene插件,提供了使用lucene所需的相关指令。

Notifications You must be signed in to change notification settings

shangheng/alogic-xscript-lucene

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alogic-xscript-lucene

基于xscript2.0的lucene插件

Overview

alogic-xscript-lucene是基于xscript2.0的lucene插件,提供了使用lucene所需的相关指令。

Getting started

按照以下步骤,您可轻松在您的项目中使用alogic-xscript-lucene.

不过开始之前,我们希望您了解xscript的相关知识。

Example

下面的案例是构建lucene索引.

<?xml version="1.0"?>
<script>
    <using xmlTag="lucene" module="com.alogic.xscript.lucene.IndexConf"/>

    <lucene indexDir="D:\\luceneIndex" analyzer="StandardAnalyzer">
    	<!-- create为false即批量增加索引,默认为false;
    		true即新建索引,如果是第一次用lucene建立索引,则必须设置为true -->
    	<idx-writer create="true">
	        <!-- 在这里你可以使用alogic-xcript-lucene提供的语句
	           type有text和Blob两种类型
	        -->        
	        <idx-new type="text" id="text1" value="hello,man!"/>
	        <idx-new type="text" id="text2" value="goodby,man!"/>
	        <idx-new type="text" id="text3" value="hello,woman!"/>
	        <idx-new type="text" id="text4" value="goodbye,woman!"/>   
        </idx-writer>   
    	 <idx-reader>
	        <!-- 在这里你可以使用alogic-xcript-lucene提供的语句
	        	第一种情况,没有过滤器的简单查询
	        	第二种情况,过滤器查询
	        -->
       		<!-- <idx-query type="TermQuery" field="content" q="man"/> -->
        	<idx-query>
        		<filter module="Multi">
        			<filter module="QueryParse" analyzer="StandardAnalyzer" occur="MUST" field="content" q="woman"/>
        			<filter module="QueryParse" analyzer="StandardAnalyzer" occur="MUST_NOT" field="content" q="man"/>
        		</filter>
        	</idx-query>
        </idx-reader>
        <idx-writer>
        <!-- 在这里你可以使用alogic-xcript-lucene提供的语句
        -->
     	   <idx-update id="text4" value="hello,world,woman!" />
        </idx-writer>
        <idx-writer>
        <!-- 在这里你可以使用alogic-xcript-lucene提供的语句
        -->
       		<idx-delete field="content" q="man" />
        </idx-writer>
    </lucene>
</script>

指令参考

参见alogic-xscript-lucene参考

About

alogic-xscript-lucene是基于xscript2.0的lucene插件,提供了使用lucene所需的相关指令。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages