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 Chris Johnson <cj...@zenoss.com> on 2014/09/30 17:41:29 UTC

complexphrase with wildcards

https://gist.github.com/kindkid/c9f0ed9ee417064c1245

I'm using Solr 4.10.0, and getting a couple of error messages for
invalid complexphrase queries that I don't understand. Are these known
bugs or am I just doing something wrong?

Relevant portion of schema.xml...
=================================

  <fieldType name="summaryText" class="solr.TextField"
positionIncrementGap="100" required="false" indexed="true"
stored="false" multiValued="true" omitNorms="true">
    <analyzer type="index">
      <tokenizer class="solr.WhitespaceTokenizerFactory"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.ReversedWildcardFilterFactory"
withOriginal="true" maxPosAsterisk="1" maxPosQuestion="1"/>
    </analyzer>
    <analyzer type="query">
      <tokenizer class="solr.WhitespaceTokenizerFactory"/>
      <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
  </fieldType>

  <field name="summary" type="summaryText"/>

Some valid queries, for comparison...
=====================================

summary:arrrr
summary:matey
summary:arr*
summary:*rrr
summary:mate*
summary:*tey
summary:"arrrr matey"

summary:"arrrr mate*" #no match

_query_:"{!complexphrase}summary:\"arr* mate*\""

summary:(arr* *tey) # but this ignores ordering of terms, equivalent to...

summary:(*tey *arr) # same as above



The invalid queries...
======================

_query_:"{!complexphrase}summary:\"arr* *tey\""
# "org.apache.solr.search.SyntaxError:
org.apache.lucene.queryparser.classic.ParseException: Cannot parse
'arr* *matey*': '*' or '?' not allowed as first character in
WildcardQuery"


_query_:"{!complexphrase}summary:\"arr*\""
# "Unknown query type \"org.apache.lucene.search.PrefixQuery\" found
in phrase query string \"arr*\""

- chris