You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Hanjan, Harinder" <Ha...@calgary.ca> on 2018/08/22 16:58:00 UTC

field was indexed without position data; cannot run SpanTermQuery

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.

Re: [EXT] Re: field was indexed without position data; cannot run SpanTermQuery

Posted by Erick Erickson <er...@gmail.com>.
Oh, there are a number of reasons a text-based field wouldn't work,
omitPosition=true would be one ;).

Glad to hear it's working though.

Best,
Erick

On Wed, Aug 22, 2018 at 10:42 AM, Hanjan, Harinder
<Ha...@calgary.ca> wrote:
> 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:erickerickson@gmail.com]
> Sent: Wednesday, August 22, 2018 11:16 AM
> To: solr-user <so...@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 <Ha...@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.

RE: [EXT] Re: field was indexed without position data; cannot run SpanTermQuery

Posted by "Hanjan, Harinder" <Ha...@calgary.ca>.
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:erickerickson@gmail.com] 
Sent: Wednesday, August 22, 2018 11:16 AM
To: solr-user <so...@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 <Ha...@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.

Re: field was indexed without position data; cannot run SpanTermQuery

Posted by Erick Erickson <er...@gmail.com>.
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
<Ha...@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.