how to search all / wildcard in lucern solr

試著忘記壹切 提交于 2019-12-24 00:06:53

问题


I'm using RoR + acts_as_solr to query a Solr database.

I'm used to using "*" to select all, thanks to MySQL, but that command fires an exception in Solr. Are they other wildcards I can use? Suggestions? Thanks!


回答1:


You can't query for "all" in lucene. The typical way to do it is to add a field with the same value for all documents and query for that value.




回答2:


In Solr you can get all documents by querying *:* (except for pagination, that's another topic)




回答3:


I prefer [* TO *] when I have used acts_as_solr. *:* seemed to perform much slower.




回答4:


It depends what you need to select all data for. By emulating a select * I assume you want all fields back from the document; this would happen naturally from your search terms as you just limit the documents returned.

select * from index where id = 'Burrito'

would be the same as just searching for

id:Burrito

You would not have to do

*:* AND id:Burrito

If you want to see all the documents then use : as already suggested.



来源:https://stackoverflow.com/questions/977560/how-to-search-all-wildcard-in-lucern-solr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!