WildcardQuery error in Solr

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

    If you are just trying to get all documents, Solr does support the *:* query. It's the only time I know of that Solr will let you begin a query with an *. I'm sure you've probably seen this as the default query in the Solr admin page.

    If you are trying to do a more specific query with an * as the first character, like say id:*456 then one of the best ways I've seen is to index that field twice. Once normally (field name: id), and once with all the characters reversed (field name: reverse_id). Then you could essentially do the query id:456 by sending the query reverse_id:654 instead. Hope that makes sense.

    You can also search the Solr user group mailing list at http://www.mail-archive.com/solr-user@lucene.apache.org/ where questions like this come up quite often.

提交回复
热议问题