New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lucene KeywordAnalyzer cannot be found #794

Open
joewiz opened this Issue Sep 23, 2015 · 7 comments

Comments

Projects
None yet
3 participants
@joewiz
Member

joewiz commented Sep 23, 2015

Lucene's KeywordAnalyzer cannot be found on a standard trunk build. When launching eXist with the following collection.xconf:

<collection xmlns="http://exist-db.org/collection-config/1.0" xmlns:test="test">
    <index xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <fulltext default="none" attributes="false"/>
        <lucene>
            <analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
            <analyzer id="ws" class="org.apache.lucene.analysis.core.WhitespaceAnalyzer"/>
            <analyzer id="keyword" class="org.apache.lucene.analysis.core.KeywordAnalyzer"/>
            <text qname="test:para"/>
            <text qname="test:para" field="para-standard"/>
            <text qname="test:para" field="para-ws" analyzer="ws"/>
            <text qname="test:para" field="para-keyword" analyzer="keyword"/>
        </lucene>
    </index>
</collection>

exist.log reports the following error:

23 Sep 2015 14:40:15,394 [main] DEBUG (AnalyzerConfig.java [createInstance]:261) - Using analyzer org.apache.lucene.analysis.standard.StandardAnalyzer
23 Sep 2015 14:40:15,395 [main] DEBUG (AnalyzerConfig.java [createInstance]:261) - Using analyzer org.apache.lucene.analysis.core.WhitespaceAnalyzer
23 Sep 2015 14:40:15,395 [main] ERROR (AnalyzerConfig.java [createInstance]:269) - Could not find matching analyzer class constructororg.apache.lucene.analysis.core.KeywordAnalyzer: org.apache.lucene.analysis.core.KeywordAnalyzer.<init>(org.apache.lucene.util.Version)
java.lang.NoSuchMethodException: org.apache.lucene.analysis.core.KeywordAnalyzer.<init>(org.apache.lucene.util.Version)
    at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_60]
    …

For a reproducible test, including files, see this thread from exist-open: http://markmail.org/message/heesn3keggjkkmbg.

@adamretter

This comment has been minimized.

Show comment
Hide comment
@adamretter

adamretter Sep 23, 2015

Member

@joewiz Can you post a few more lines from the stacktrace? At least down to a few lines which are in the org.exist namespace.

Member

adamretter commented Sep 23, 2015

@joewiz Can you post a few more lines from the stacktrace? At least down to a few lines which are in the org.exist namespace.

@joewiz

This comment has been minimized.

Show comment
Hide comment
@joewiz

joewiz Sep 23, 2015

Member

Sure, here is the full stacktrace:

2015-09-23 10:01:51,704 [Thread-3] ERROR (AnalyzerConfig.java [createInstance]:269) - Could not find matching analyzer class constructororg.apache.lucene.analysis.core.KeywordAnalyzer: org.apache.lucene.analysis.core.KeywordAnalyzer.<init>(org.apache.lucene.util.Version) 
java.lang.NoSuchMethodException: org.apache.lucene.analysis.core.KeywordAnalyzer.<init>(org.apache.lucene.util.Version)
    at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_45]
    at java.lang.Class.getDeclaredConstructor(Class.java:2178) ~[?:1.8.0_45]
    at org.exist.indexing.lucene.AnalyzerConfig.createInstance(AnalyzerConfig.java:257) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.AnalyzerConfig.configureAnalyzer(AnalyzerConfig.java:224) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.AnalyzerConfig.addAnalyzer(AnalyzerConfig.java:118) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.LuceneConfig.parseConfig(LuceneConfig.java:260) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.LuceneConfig.parseConfig(LuceneConfig.java:256) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.LuceneConfig.<init>(LuceneConfig.java:75) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.LuceneIndexWorker.configure(LuceneIndexWorker.java:156) [exist-index-lucene.jar:?]
    at org.exist.indexing.IndexController.configure(IndexController.java:83) [exist.jar:?]
    at org.exist.storage.IndexSpec.read(IndexSpec.java:106) [exist.jar:?]
    at org.exist.storage.IndexSpec.<init>(IndexSpec.java:67) [exist.jar:?]
    at org.exist.collections.CollectionConfiguration.read(CollectionConfiguration.java:152) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.loadConfiguration(CollectionConfigurationManager.java:287) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.loadAllConfigurations(CollectionConfigurationManager.java:261) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.loadAllConfigurations(CollectionConfigurationManager.java:269) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.loadAllConfigurations(CollectionConfigurationManager.java:269) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.loadAllConfigurations(CollectionConfigurationManager.java:253) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.<init>(CollectionConfigurationManager.java:86) [exist.jar:?]
    at org.exist.storage.BrokerPool.initCollectionConfigurationManager(BrokerPool.java:1360) [exist.jar:?]
    at org.exist.storage.BrokerPool.initialize(BrokerPool.java:939) [exist.jar:?]
    at org.exist.storage.BrokerPool.<init>(BrokerPool.java:720) [exist.jar:?]
    at org.exist.storage.BrokerPool.configure(BrokerPool.java:254) [exist.jar:?]
    at org.exist.storage.BrokerPool.configure(BrokerPool.java:228) [exist.jar:?]
    at org.exist.jetty.JettyStart.run(JettyStart.java:167) [exist-optional.jar:?]
    at org.exist.launcher.Launcher$4.run(Launcher.java:145) [exist.jar:?]
Member

joewiz commented Sep 23, 2015

Sure, here is the full stacktrace:

2015-09-23 10:01:51,704 [Thread-3] ERROR (AnalyzerConfig.java [createInstance]:269) - Could not find matching analyzer class constructororg.apache.lucene.analysis.core.KeywordAnalyzer: org.apache.lucene.analysis.core.KeywordAnalyzer.<init>(org.apache.lucene.util.Version) 
java.lang.NoSuchMethodException: org.apache.lucene.analysis.core.KeywordAnalyzer.<init>(org.apache.lucene.util.Version)
    at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_45]
    at java.lang.Class.getDeclaredConstructor(Class.java:2178) ~[?:1.8.0_45]
    at org.exist.indexing.lucene.AnalyzerConfig.createInstance(AnalyzerConfig.java:257) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.AnalyzerConfig.configureAnalyzer(AnalyzerConfig.java:224) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.AnalyzerConfig.addAnalyzer(AnalyzerConfig.java:118) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.LuceneConfig.parseConfig(LuceneConfig.java:260) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.LuceneConfig.parseConfig(LuceneConfig.java:256) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.LuceneConfig.<init>(LuceneConfig.java:75) [exist-index-lucene.jar:?]
    at org.exist.indexing.lucene.LuceneIndexWorker.configure(LuceneIndexWorker.java:156) [exist-index-lucene.jar:?]
    at org.exist.indexing.IndexController.configure(IndexController.java:83) [exist.jar:?]
    at org.exist.storage.IndexSpec.read(IndexSpec.java:106) [exist.jar:?]
    at org.exist.storage.IndexSpec.<init>(IndexSpec.java:67) [exist.jar:?]
    at org.exist.collections.CollectionConfiguration.read(CollectionConfiguration.java:152) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.loadConfiguration(CollectionConfigurationManager.java:287) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.loadAllConfigurations(CollectionConfigurationManager.java:261) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.loadAllConfigurations(CollectionConfigurationManager.java:269) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.loadAllConfigurations(CollectionConfigurationManager.java:269) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.loadAllConfigurations(CollectionConfigurationManager.java:253) [exist.jar:?]
    at org.exist.collections.CollectionConfigurationManager.<init>(CollectionConfigurationManager.java:86) [exist.jar:?]
    at org.exist.storage.BrokerPool.initCollectionConfigurationManager(BrokerPool.java:1360) [exist.jar:?]
    at org.exist.storage.BrokerPool.initialize(BrokerPool.java:939) [exist.jar:?]
    at org.exist.storage.BrokerPool.<init>(BrokerPool.java:720) [exist.jar:?]
    at org.exist.storage.BrokerPool.configure(BrokerPool.java:254) [exist.jar:?]
    at org.exist.storage.BrokerPool.configure(BrokerPool.java:228) [exist.jar:?]
    at org.exist.jetty.JettyStart.run(JettyStart.java:167) [exist-optional.jar:?]
    at org.exist.launcher.Launcher$4.run(Launcher.java:145) [exist.jar:?]
@joewiz

This comment has been minimized.

Show comment
Hide comment
@joewiz

joewiz Sep 23, 2015

Member

(Using a fresh installation of eXist-db 3.0RC1, downloaded via exist-db.org.)

Member

joewiz commented Sep 23, 2015

(Using a fresh installation of eXist-db 3.0RC1, downloaded via exist-db.org.)

@ljo

This comment has been minimized.

Show comment
Hide comment
@ljo

ljo Sep 23, 2015

Member

I am not shure there is any real problem here . The log just shows the default invocation (with version) that fails which is followed by another attempt. I have changed this for the new Lucene since version is not a constructor parameter anymore.
But I will check. Looking at other exceptions in this area anyway.

Member

ljo commented Sep 23, 2015

I am not shure there is any real problem here . The log just shows the default invocation (with version) that fails which is followed by another attempt. I have changed this for the new Lucene since version is not a constructor parameter anymore.
But I will check. Looking at other exceptions in this area anyway.

@joewiz

This comment has been minimized.

Show comment
Hide comment
@joewiz

joewiz Sep 23, 2015

Member

Thanks, @ljo. If the error reported by the stacktrace isn't a problem, the original problem that prompted this thread is that the keyword analyzer — like the whitespace analyzer reported in #795 — isn't working. For example, given a collection.xconf like this:

<collection xmlns="http://exist-db.org/collection-config/1.0" xmlns:test="test">
    <index xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <fulltext default="none" attributes="false"/>
        <lucene>
            <analyzer="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
            <analyzer id="ws" class="org.apache.lucene.analysis.core.WhitespaceAnalyzer"/>
            <analyzer id="keyword" class="org.apache.lucene.analysis.core.KeywordAnalyzer"/>
            <text qname="test:para"/>
            <text qname="test:para" field="para-standard"/>
            <text qname="test:para" field="para-ws" analyzer="ws"/>
            <text qname="test:para" field="para-keyword" analyzer="keyword"/>
        </lucene>
    </index>
</collection>

and a test file like this:

<doc xmlns="test">
    <para>Hello, my name is Joe.</para>
</doc>

The following query returns 0 results:

ft:query-field('para-keyword', 'Hello, my name is Joe.')
Member

joewiz commented Sep 23, 2015

Thanks, @ljo. If the error reported by the stacktrace isn't a problem, the original problem that prompted this thread is that the keyword analyzer — like the whitespace analyzer reported in #795 — isn't working. For example, given a collection.xconf like this:

<collection xmlns="http://exist-db.org/collection-config/1.0" xmlns:test="test">
    <index xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <fulltext default="none" attributes="false"/>
        <lucene>
            <analyzer="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
            <analyzer id="ws" class="org.apache.lucene.analysis.core.WhitespaceAnalyzer"/>
            <analyzer id="keyword" class="org.apache.lucene.analysis.core.KeywordAnalyzer"/>
            <text qname="test:para"/>
            <text qname="test:para" field="para-standard"/>
            <text qname="test:para" field="para-ws" analyzer="ws"/>
            <text qname="test:para" field="para-keyword" analyzer="keyword"/>
        </lucene>
    </index>
</collection>

and a test file like this:

<doc xmlns="test">
    <para>Hello, my name is Joe.</para>
</doc>

The following query returns 0 results:

ft:query-field('para-keyword', 'Hello, my name is Joe.')
@joewiz

This comment has been minimized.

Show comment
Hide comment
@joewiz

joewiz Sep 23, 2015

Member

(Confirmed by @jensopetersen.)

Member

joewiz commented Sep 23, 2015

(Confirmed by @jensopetersen.)

@adamretter

This comment has been minimized.

Show comment
Hide comment
@adamretter

adamretter Feb 17, 2018

Member

@joewiz Can you confirm if this is still a problem?

Member

adamretter commented Feb 17, 2018

@joewiz Can you confirm if this is still a problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment