WildcardQuery error in Solr

后端 未结 7 2267
花落未央
花落未央 2021-02-20 16:47

I use solr to search for documents and when trying to search for documents using this query \"id:*\", I get this query parser exception telling that it cannot parse

7条回答
  •  独厮守ぢ
    2021-02-20 17:23

    I'm assuming with id:* you're just trying to match all documents, right?

    I've never used solr before, but in my Lucene experience, when ingesting data, we've added a hidden field to every document, then when we need to return every record we do a search for the string constant in that field that's the same for every record.

    If you can't add a field like that in your situation, you could use a RegexQuery with a regex that would match anything that could be found in the id field.

    Edit: actually answering the question. I've never heard of a patch to get that to work, but I would be surprised if it could even be made to work reasonably well. See this question for a reason why unconstrained PrefixQuery's can cause a problem.

提交回复
热议问题