2

我有我Solr schema喜欢的领域-

Type - <fieldType name="text" class="solr.TextField" positionIncrementGap="100"/>
Declaration - <field name="description" type="text" indexed="true" stored="true"/>

description字段具有某些文档的值,而其余文档则没有数据。当该字段没有数据时,我没有明确设置任何内容,description因为它不是一个required字段。

问题是当我使用 - 查询时description:*。我得到一个NullPointerException.

我没有更改schema. 同样,当我查询description:abc它时,它仍然适用,description:*并且description:abc*它给出了一个NullPointerException.

  • 这是正确的行为吗?
  • text当我们不必设置时,是否需要为字段赋予“”值?

例外 -

"error":{
   "trace":"java.lang.NullPointerException\n\tat 
        org.apache.solr.schema.TextField.analyzeMultiTerm(TextField.java:139)\n\tat org.apache.solr.search.SolrQueryParser.analyzeIfMultitermTermText(SolrQueryParser.java:147)\n\tat 
    org.apache.solr.search.SolrQueryParser.getWildcardQuery(SolrQueryParser.java:203)\n\tat 
    org.apache.lucene.queryparser.classic.QueryParserBase.handleBareTokenQuery(QueryParserBase.java:1049)\n\tat 
    org.apache.lucene.queryparser.classic.QueryParser.Term(QueryParser.java:358)\n\tat 
    org.apache.lucene.queryparser.classic.QueryParser.Clause(QueryParser.java:257)\n\tat 
    org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:181)\n\tat 
    org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:170)\n\tat 
    org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:120)\n\tat
     org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:72)\n\tat 
    org.apache.solr.search.QParser.getQuery(QParser.java:143)\n\tat 
    org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:118)\n\tat 
    org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:185)\n\tat 
    org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)\n\tat
     org.apache.solr.core.SolrCore.execute(SolrCore.java:1699)\n\tat 
    org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:455)\n\tat 
    org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:276)\n\tat 
    org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1337)\n\tat 
    org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:484)\n\tat 
    org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)\n\tat 
    org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)\n\tat 
    org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)\n\tat 
    org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)\n\tat 
    org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)\n\tat 
    org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)\n\tat 
    org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)\n\tat 
    org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)\n\tat 
    org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)\n\tat 
    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)\n\tat
     org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)\n\tat 
    org.eclipse.jetty.server.Server.handle(Server.java:351)\n\tat 
    org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)\n\tat 
    org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)\n\tat 
    org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)\n\tat 
    org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)\n\tat 
    org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)\n\tat 
    org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)\n\tat 
    org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)\n\tat
     org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)\n\tat 
    org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)\n\tat 
    org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)\n\tat 
    java.lang.Thread.run(Thread.java:679)\n",
            "code":500}}
4

2 回答 2

1

A field of type solr.TextField has to have a Tokenizer associated with it otherwise it fails for wild character search.

I created a Jira bug for the same here.

于 2013-01-20T22:55:10.010 回答
0

它应该工作并且正常工作。

您是否偶然更改了字段类型定义,然后没有进行完整的重新索引(删除旧索引等)?

I have seen this before but it seemed to have gone away after the index was fully rebuilt. May be something to do with left-over definitions on Lucene level.

于 2013-01-18T00:13:15.153 回答