Perhaps my memory fails me, I remember setting it as a text field and it not working. In any case, I have set it up as follows and things are working well.
<fieldType name="text_type-ahead" class="solr.TextField" positionIncrementGap="100"> <analyzer> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> </fieldType> Thanks Erick! -----Original Message----- From: Erick Erickson [mailto:erickerick...@gmail.com] Sent: Wednesday, August 22, 2018 11:16 AM To: solr-user <solr-user@lucene.apache.org> Subject: [EXT] Re: field was indexed without position data; cannot run SpanTermQuery 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://urldefense.proofpoint.com/v2/url?u=https-3A__lucene.apache.org_solr_guide_6-5F6_defining-2Dfields.html&d=DwIFaQ&c=jdm1Hby_BzoqwoYzPsUCHSCnNps9LuidNkyKDuvdq3M&r=N30IrhmaeKKhVHu13d-HO9gO9CysWnvGGoKrSNEuM3U&m=2GSWQKu6aYflteP6PPE5Td_FWHCz0OtC_mDEDe7HBDU&s=HpsOvlutGSAh9qm_xbMoTeRgoXfpA3Emq3okIoHpoP0&e=) 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(S > panTermQuery.java:119) at > org.apache.lucene.search.spans.SpanNearQuery$SpanNearWeight.getSpans(S > panNearQuery.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(Sol > rIndexSearcher.java:215) at > org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearche > r.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.doProcessUngroupedSea > rch(QueryComponent.java:1435) at > org.apache.solr.handler.component.QueryComponent.process(QueryComponen > t.java:375) at > org.apache.solr.handler.component.SearchHandler.handleRequestBody(Sear > chHandler.java:295) at > org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandle > rBase.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(ServletH > andler.java:1751) at > org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java: > 582) at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.ja > va:143) at > org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java > :548) at > org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandle > r.java:226) at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandle > r.java:1180) at > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:5 > 12) 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.ja > va:141) at > org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(Conte > xtHandlerCollection.java:213) at > org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerColle > ction.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(Abstrac > tConnection.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.executePr > oduceConsume(ExecuteProduceConsume.java:303) > at > org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceCo > nsume(ExecuteProduceConsume.java:148) > at > org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(Execu > teProduceConsume.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.