简体   繁体   中英

How to use an analyzer in compass-lucene search

How do I add compass analyzer while indexing and searching data in compass.I am using schema based configuration for compass.I want to use StandardAnalyzer with no stopwords.Because I want to index data as it is,without ignoring search terms like AND , OR , IN . The default analyzer will ignore AND , OR , IN from the data I give for indexing.

How do I configure snowball analyzer either thru code or thru xml. If someone could post me an example.

Below is the example. You can also find more details here

<comp:searchEngine useCompoundFile="false" cacheInvalidationInterval="-1">
        <comp:allProperty enable="false" />
        <!--
            By Default, compass uses StandardAnalyzer for indexing and searching. StandardAnalyzer
            will use certain stop words (stop words are not indexed and hence not searcheable) which are
            valid search terms in the DataSource World. For e.g. 'in' for Indiana state, 'or' for Oregon etc.
            So we need to provide our own Analyzer.
        -->
        <comp:analyzer name="default" type="CustomAnalyzer"
            analyzerClass="com.ICStandardAnalyzer" />
        <comp:analyzer name="search" type="CustomAnalyzer"
            analyzerClass="com.ICStandardAnalyzer" />
        <!--
            Disable the optimizer as we will optimize the index as a separate batch job

            Also, the merge factor is set to 1000, so that merging doesnt happen during the commit time.
            Merging is a time consuming process and will be done by the batched optimizer
        -->
        <comp:optimizer schedule="false" mergeFactor="1000"/>
    </comp:searchEngine>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM