Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wildcard to select all items in Solr

Tags:

solr

I'm currently using Local Solr for doing geo searching. It takes in lat and long parameters as well as a search query. I want to create nearby functionality, where I don't need to provide a location and not a search query. Is there a way to provide a wildcard query that matches all elements then order by the distance? Is the best to create another field and place the same value in all fields?

Thanks.

like image 749
prostock Avatar asked Feb 03 '11 00:02

prostock


2 Answers

You can use the query *:* to match all values in all fields.

See http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F for an example on how to query all documents using the *:* wildcard.

See also http://wiki.apache.org/solr/SolrQuerySyntax for general Solr syntax help.

like image 55
Aaron D Avatar answered Jan 01 '23 09:01

Aaron D


You may use Solr spatial search to sort by distance, and your query can be *:* if you want to pull all documents from your index.

   eg: ?q=*:*&sfield=search_field&pt=22.12,-55.56&sort=geodist() asc

http://wiki.apache.org/solr/SpatialSearch

like image 24
Aujasvi Chitkara Avatar answered Jan 01 '23 08:01

Aujasvi Chitkara