happythenewsad
happythenewsad

Reputation: 1785

how to search all / wildcard in lucern solr

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!

Upvotes: 2

Views: 4638

Answers (4)

FridayChils
FridayChils

Reputation: 71

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.

Upvotes: 0

Mark Redding
Mark Redding

Reputation: 209

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

Upvotes: 2

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99730

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

Upvotes: 14

jshen
jshen

Reputation: 11907

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.

Upvotes: -1

Related Questions