WildcardQuery error in Solr

后端 未结 7 2345
花落未央
花落未央 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:12

    Lucene doesn't allow you to start WildcardQueries with an asterisk by default, because those are incredibly expensive queries and will be very, very, very slow on large indexes.

    If you're using the Lucene QueryParser, call setAllowLeadingWildcard(true) on it to enable it.

    If you want all of the documents with a certain field set, you are much better off querying or walking the index programmatically than using QueryParser. You should really only use QueryParser to parse user input.

提交回复
热议问题