2

I have a field in my Solr schema like -

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

This description field has values for some documents and no data for the remaining. I am not explicitly setting anything when there is no data for the description field as it is not a required field.

The problem is when i query using - description:*. I get a NullPointerException.

I have not changed the schema. Also when I query description:abc it works however for description:* and description:abc* it gives a NullPointerException.

  • Is it the correct behavior?
  • Are the text fields required to be given "" values when we do not have to set it?

Exception -

"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}}
JHS
  • 7,761
  • 2
  • 29
  • 53

2 Answers2

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.

JHS
  • 7,761
  • 2
  • 29
  • 53
0

It should work and does normally work.

Did you by any chance change field type definition and then did not do a full-reindex (delete old index and so on)?

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.

Alexandre Rafalovitch
  • 9,709
  • 1
  • 24
  • 27
  • Nope. I started afresh and still the same problem. Infact when I add the same field in facet it gives me a facet. But on searching it fails. Also if search for `description:the` it works but the moment i add a `*` in the end it fails. – JHS Jan 18 '13 at 17:23
  • 1
    If you can easily reproduce it, you probably want to create a JIRA issue for Solr. In a meanwhile, do you by any chance have a dynamic field for * or maybe description*. Try to see if there is a minimal problem case. – Alexandre Rafalovitch Jan 18 '13 at 17:52