Friday, April 22, 2016

Search Sitecore items from solr index through web admin panel

Search Sitecore items/Documents from solr index through web admin panel

Hi guys, in this blog I am trying to highlight some important queries of solr index that we can execute through solr web admin panel itself.

Most of the times we need to find out some items/results from index file based on some basic queries for diagnose purpose like Keyword search, wildcard search, Range Search, AND, OR condition etc.
So to achieve  the above search operation,

Go to solr admin> http://localhost:8999/solr/ (changed your solr instance name) > Query Tab>




Query panel

Now the most important part of this console panel is Query page, this page is very important from developer point of view to get the document from the index based on some parameter.

So there is some default parameter for query the document from solr index:

Parameter name
Default
Modified
Request handler
Select

Q
Query by default *:*
Change as per need
Sort

For sorting: can provide field name
start, rows
By default 0,10 (return 10 documents)
Can change like 0,50(to return 50 document)
Wt
Json(Result format)
Can change like xml(result will come in xml format)


Below are the some basic query snippets for search the item from solr index

Statement
Query Syntax
Description
Select All
*:*
return all documents without any filter
Keyword Search
Phrase Search

Filed name: “value”  (Example Product:”Sitecore”  
Return all result where Product exact match with “sitecore”
FieldName: Value AND FieldName: Value (example Product:”sitecore” And Title:”Demo”
AND operator matching the field value with and condition
OR Condition
FieldName: Value OR FieldName: Value (example Product:”sitecore” OR   Title:”Demo”
OR operator matching the field value with OR condition
Wildcard Search
FieldName: Value*(Example product:sitecore*
Search all product that start from sitecore
Range Search
FieldName:[ value TO Value](Example mod_date:[20020101 TO 20030101]
Range Queries allow one to match documents whose field(s) values are between the lower and upper bound specified by the Range Query


Run > execute query > show the result in right panel.

I hope you enjoyed this articleJ

Happy sitecore