Solr: Finding out all values in a field
Solr and Lucene are truly amazing things, capable of fast indexing and querying vast amounts of data.
However, when coming from a conventional database structure, it’s quite hard getting to the thinking pattern Lucene uses vs SQL (e.g.)
SQL: select fieldname from database
The equivalent of select fieldname from database as known in SQL databases, is one of those fun ones. One would think it would translate simply to something like:
q=fieldname%3A*&start=0&rows=10&fl=*%2Cscore&qt=standard&wt=standard
Basically you’re querying for any value in the fieldname. However, Lucene/Solr doesn’t support this!
q=*%3A*&start=0&rows=10&fl=$%2Cscore&qt=standard&wt=standard&facet=true&facet.field=fieldname
Yeah, just facetting on the field actually gives you all the possibilities & the count of items in that category.
You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.