Disadvantage

Standard query parser does not throw any syntax error. So, identifying syntax errors is a little tough.

The following parameters are supported by standard query parser. We can configure them in solrconfig.xml:

Parameter

Behavior

Default value

q

Specifies a query using standard query syntax. This is a mandatory parameter for any request.

q.op

Specifies the default operator for query expressions, which overrides the default operator configured inside the schema. Possible values are AND or OR.

df

Specifies a default field, which overrides the default field definition inside the schema.

sow

If this is set to true, it splits on white spaces.

false

Standard query parser response: The following is the sample response provided by the standard query parser when we search for field id=SP2514N

URLhttp://localhost:8983/solr/techproducts/select?q=SP2514N&wt=json

In Solr admin console, while running a query to search a product with id=SP2514N displays the response as follows:

The response code is as follows:

{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"SP2514N",
"wt":"json",
"_":"1515346597997"}},
"response":{"numFound":1,"start":0,"docs":[
{
"id":"SP2514N",
"name":"Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133",
"manu":"Samsung Electronics Co. Ltd.",
"manu_id_s":"samsung",
"cat":["electronics",
"hard drive"],
"features":["7200RPM, 8MB cache, IDE Ultra ATA-133",
"NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor"],
"price":92.0,
"price_c":"92.0,USD",
"popularity":6,
"inStock":true,
"manufacturedate_dt":"2006-02-13T15:26:37Z",
"store":"35.0752,-97.032",
"_version_":1583131913641525248,
"price_c____l_ns":9200}]
}}

In the same way, now the query id=SP2514N; and we need only two fields, id and name, in response.

URLhttp://localhost:8983/solr/techproducts/select?fl=id,name&q=SP2514N&wt=json.

Response:

{
"responseHeader":{
"status":0,
"QTime":17,
"params":{
"q":"SP2514N",
"fl":"id,name",
"wt":"json",
"_":"1515346597997"}},
"response":{"numFound":1,"start":0,"docs":[
{
"id":"SP2514N",
"name":"Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133"}]
}}

We can format the response by setting the wt parameter as json, xml, xslt, javabin, geojson, python, php, phps, ruby, csv, velocity, smile, or xlsx.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.43.134