lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <ysee...@gmail.com>
Subject Re: Solr cannot return result when query with # * like title:#7654321*
Date Thu, 28 Jan 2016 03:13:36 GMT
Are you sure the query is getting through unadulterated to Solr?

For example:

/opt/code/lusolr$ curl 'http://localhost:8983/solr/techproducts/query?q=id:#foo'
{
  "responseHeader":{
    "status":400,
    "QTime":2,
    "params":{
      "q":"id:"}},
  "error":{
    "msg":"org.apache.solr.search.SyntaxError: Cannot parse 'id:':
Encountered \"<EOF>\" at line 1, column 3.\nWas expecting one of:\n
<BAREOPER> ...\n    \"(\" ...\n    \"*\" ...\n    <QUOTED> ...\n
<TERM> ...\n    <PREFIXTERM> ...\n    <WILDTERM> ...\n    <REGEXPTERM>
...\n    \"[\" ...\n    \"{\" ...\n    <LPARAMS> ...\n    \"filter(\"
...\n    <NUMBER> ...\n    ",
    "code":400}}


Look at the echoed params, and how they were cut off at the "#" which
is special for URLs (and needs to be URL encoded).
Whether *you* need to URL encode it depends on exactly how you are
sending the request to Solr.  With a browser or with curl, you will
need to do it yourself... but other types of clients like SolrJ should
do it for you.

-Yonik


On Wed, Jan 27, 2016 at 10:00 PM, diyun2008 <diyun2008@gmail.com> wrote:
> Hi Eric
>
>     Thank you for your reply.
>     I saw the admin/analyze page before.
>
>     The string "titile:#7654321" for index analysis hit ST with "7654321"
> .(That means # is not indexed)
>     The string "title:#7654321*" for query analysis hit ST(Standard
> Tokenizer) with "7654321" as well.
>
>     What I was rather confused is if they all hit same string "7654321", why
> it cannot return the hit result by query(q=#7654321*)?
>
>     BTW, The title type is "text_general" and it uses Standard Tokenizer.

Mime
View raw message