StrFields are, by definition, unanalyzed. They cannot have position information because they are always one token. Searching for a phrase on a single token makes no sense. The error message is a little odd, but accurate.
You'll have to re-index as a text-based field if you want this kind of functionality, and position information must be enabled on that field or you'll get the same error (see omitTermFreqAndPosition, omitPosition etc. here: https://lucene.apache.org/solr/guide/6_6/defining-fields.html) Best, Erick On Wed, Aug 22, 2018 at 9:58 AM, Hanjan, Harinder <harinder.han...@calgary.ca> wrote: > Hello! > > I am doing wildcard queries to satisfy our search type ahead requirement for > both single and mutli word (phrases) queries. > I just noticed this error in the logs. > > 2018-08-22 16:36:48.433 INFO (qtp1654589030-18) [ x:suggestions] > o.a.s.c.S.Request [suggestions] webapp=/solr path=/select > params={q={!complexphrase}"traffic+c*"} status=500 QTime=7 > 2018-08-22 16:36:48.433 ERROR (qtp1654589030-18) [ x:suggestions] > o.a.s.s.HttpSolrCall null:java.lang.IllegalStateException: field "suggestion" > was indexed without position data; cannot run SpanTermQuery (term=traffic) > > The error is only thrown when I search for phrases but works fine for single > word queries. > This causes the error: q={!complexphrase}"traffic c*" > This runs fine: q={!complexphrase}"traffic*" > > <field name="suggestion" type="string" stored="true" indexed="true" > required="true" /> > <fieldType name="string" class="solr.StrField" sortMissingLast="true" /> > > How can I troubleshoot this? The field 'suggestion' is stored as a StrField, > could that be the reason? > > > Full stack trace: > 2018-08-22 16:55:49.164 INFO (qtp1654589030-17) [ x:suggestions] > o.a.s.c.S.Request [suggestions] webapp=/solr path=/select > params={q={!complexphrase}"traffic+c*"} status=500 QTime=6 > 2018-08-22 16:55:49.164 ERROR (qtp1654589030-17) [ x:suggestions] > o.a.s.s.HttpSolrCall null:java.lang.IllegalStateException: field "suggestion" > was indexed without position data; cannot run SpanTermQuery (term=traffic) > at > org.apache.lucene.search.spans.SpanTermQuery$SpanTermWeight.getSpans(SpanTermQuery.java:119) > at > org.apache.lucene.search.spans.SpanNearQuery$SpanNearWeight.getSpans(SpanNearQuery.java:214) > at org.apache.lucene.search.spans.SpanWeight.scorer(SpanWeight.java:121) > at org.apache.lucene.search.spans.SpanWeight.scorer(SpanWeight.java:38) > at org.apache.lucene.search.Weight.bulkScorer(Weight.java:147) > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:657) > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:462) > at > org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:215) > at > org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1600) > at > org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1417) > at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:584) > at > org.apache.solr.handler.component.QueryComponent.doProcessUngroupedSearch(QueryComponent.java:1435) > at > org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:375) > at > org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:295) > at > org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:177) > at org.apache.solr.core.SolrCore.execute(SolrCore.java:2503) > at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:710) > at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:516) > at > org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:382) > at > org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:326) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1751) > at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) > at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) > at > org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) > at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) > at > org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) > at > org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) > at > org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119) > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) > at > org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335) > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) > at org.eclipse.jetty.server.Server.handle(Server.java:534) > at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) > at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) > at > org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) > at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) > at > org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) > at > org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) > at > org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) > at > org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) > at > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) > at > org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) > at java.lang.Thread.run(Thread.java:748) > > > > Thanks! > Harinder > > ________________________________ > NOTICE - > This communication is intended ONLY for the use of the person or entity named > above and may contain information that is confidential or legally privileged. > If you are not the intended recipient named above or a person responsible for > delivering messages or communications to the intended recipient, YOU ARE > HEREBY NOTIFIED that any use, distribution, or copying of this communication > or any of the information contained in it is strictly prohibited. If you have > received this communication in error, please notify us immediately by > telephone and then destroy or delete this communication, or return it to us > by mail if requested by us. The City of Calgary thanks you for your attention > and co-operation.