Solr Indexing
Indexing is the process of pushing the XML files into SOLR index, this process is also known as feeding. The other methods to get the data into SOLR are as below.
- Data import handler (DIH): it is a powerful language permits you to read from a SQL database, XML files, CSV, etc. the full- imports and the data imports will be handled by DIH. DIH is more convenient if a small amount of data were added, modernized and removed.
- HTTP interface: this method will be used for indexing the XML files. HTTP interface taken from the post tool.
- Client libraries: the client libraries have existed in different languages. For example: Java or python.
Solr Querying
It is efficient to use the HTTP interface for debugging, with any browser to query in SOLR and get back XML. The default query parser of the SOLR is known as Lucene parser.
The standard query parser parameters
Along with the Faceting parameters, common query parameters, highlighting parameters the standard query parser also supports parameters as described in the below table.
Parameters |
Description |
q |
This parameter is mandatory, helps in defining the query using standard query syntax |
q.op |
These parameters specify the default operator for query expressions, overrides the default operator as present in the schema. AND and OR are the possible values. |
df |
This recognizes the default field, overriding the default field in the schema. |
Example for responses from the Standard Query Parser
The below given URL will submit a simple query and send requests to the XML response writer to use indentation to create the XML response more readable.
http://localhost:8983/solr/softproducts/select?q=id:SP2514N
Results:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<responseHeader><status>0</status><QTime>1</QTime></responseHeader>
<result numFound="1" start="0">
<doc>
<arr name="cat"><str>Industry</str><str>Software </str></arr>
<arr name="characteristics"><str>coded in Java</str>
<str>Microsoft products, Snake-ladder gaming </str></arr>
<str name="id">Int456</str>
<bool name="inStock">true</bool>
<str name="manu">Intellipaat software Solutions </str>
<int name="popularity">6</int>
<float name="price">100.00</float>
<str name="sku">Int789</str>
</doc>
</result>
</response>
Example for query with the limited field lists
http://localhost:8983/solr/softproducts/select?q=id:SP2514N&fl=id
Results:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<responseHeader><status>0</status><QTime>2</QTime></responseHeader>
<result numFound="1" start="0">
<doc>
<str name="id">Int456</str>
</doc>
</result>
</response>