Solr query examples

Search for document with id=GB18030TEST
[code language=”text”]
http://localhost:8983/solr/collection1/select?q=id:GB18030TEST
[/code]

Search for document with id=GB18030TEST AND inStock=true
[code language=”text”]
http://localhost:8983/solr/collection1/select?q=id:GB18030TEST+AND+inStock:true
[/code]

Search for document with id=GB18030TEST OR inStock=true
[code language=”text”]
http://localhost:8983/solr/collection1/select?q=id:GB18030TEST+OR+inStock:true
[/code]

Search for all document, filter the result to return documents with inStock=true and price is less than 300. The fq parameters can be added to the q to get the same result, but fq can be cached and it will be faster if the same fq parameters are requested again. fq can also be set in the requestHandler in the solrconfig.xml and it will be appended to all incoming queries that uses this requestHandler.
[code language=”text”]
http://localhost:8983/solr/collection1/select?q=*&fq=inStock:true+AND+price:[*+TO+300]
[/code]

Search for everything and return the id, name and price of each document.
[code language=”text”]
http://localhost:8983/solr/collection1/select?q=*:*&fl=id,name,price
[/code]

Facet search with facet field of cat and price from 0 to 100, 100 to 200 and 200 up.
[code language=”text”]
http://localhost:8983/solr/collection1/select?q=*:*&fl=id,name,price&facet=true&facet.field=cat&facet.query=price:[*+TO+100]&facet.query=price:[100+TO+200]&facet.query=price:[200+TO+*]
[/code]

Search within Codexpedia

Custom Search

Search the entire web

Custom Search