INTRODUCTION:
Also, some times I would prefer to find a solr query which is exact replica of a DB query but hardly find any sources.
I realized that, the queries or the solutions are scattered across different materials and not consolidated at one place.
If you have underwent such circumstance, then you are on the right page.
Yes, this article assists you to find the solr query equivalent to a DB query.
I have chosen postgresql as the DB and listed the solr queries corresponding to a Postgresql queries.
Target audience : Folks already familiar with the basic concept of solr and its query usage.
SELECT-LIST ITEMS
1. RETURN ALL THE FIELDS
PostgreSQL: Fetches all the columns from the table.
Solr: Return all the stored fields in each document.
DB syntax | DB query | Solr Syntax | Solr query |
* | Select * from <tablename1> | fl=* | http://url/select?fl=*&indent=on&q=*:*&wt=json |
2.RETURN SPECIFIC FIELDS
PostgreSQL: Fetches the specific columns from the table.
Solr: Return the specific fields in each document.
DB syntax | DB query | Solr Syntax | Solr query |
Select <columnname1>, <columnname2> | Select <columnname1>, <columnname2>from <tablename1> | fl= <fieldname1>, <fieldname2> | http://url/select?fl=<fieldname1>,<fieldname2>&indent=on&q=*:* &wt=json |
DISTINCT
Used to remove duplicate.
DB syntax | DB query | Solr Syntax | Solr query |
distinct | Select distinct <columnname1> from <tablename1> | group=true& group.field=<fieldname1> | http://url/select? fq=<fieldname1>:<value1>&indent=on& q=*:*&wt=json&group=true& group.field=<fieldname1> |
COLUMN LABELS
PostgreSQL: Used to create alias name for columns or tables.
Solr: Used to create alias name for field.
DB syntax | DB query | Solr Syntax | Solr query |
as
|
Select <columnname1> as <alias_columnname1> from <tablename1> | fl=<alias_fieldname1>:<fieldname1> | http://url/select?fl=<alias_fieldname1>:<fieldname1>&indent=on&q=*:*&wt=json |
WHERE
Used to filter records.
DB syntax | DB query | Solr Syntax | Solr query |
where | select * from <tablename1> where <condition> | fq=<fieldname1>:<value1> | http://url/select?fq=<fieldname1>:<value1>&indent=on&q=*:*&wt=json |
GROUP BY
1. SINGLE COLUMN
Used to group the records by single field.
DB syntax | DB query | Solr Syntax | Solr query |
group by | select <columnname1> from <tablename1> where <condition> group by <columnname1> | facet=on&facet.field=<fieldname1> | http://url/select?facet.field=<fieldname1>&facet=on&indent=on&q=*:*&wt=json |
2. MULTIPLE COLUMN
Used to group the records by multiple fields.
DB syntax | DB query | Solr Syntax | Solr query |
group by <columnname1>,<columnname2> | select <columnname1>,<columnname2>from <tablename1> where <condition> group by <columnname1>,<columnname2> | facet=on&facet.pivot=<fieldname1>,<fieldname2> | http://url/select?facet=on&indent=on&q=*:*&wt=json&facet.pivot=<fieldname1>,<fieldname2> |
ORDER BY
1.ORDER BY ASC
Used to sort the records in ascending order.
DB syntax | DB query | Solr Syntax | Solr query |
asc | select * from <tablename1> order by <columnname1> asc | sort:<fieldname1> asc | http://url/select?indent=on&q=*:*&sort=<fieldname1>%20asc&wt=json |
2.ORDER BY DESC
Used to sort the records in descending order.
DB syntax | DB query | Solr Syntax | Solr query |
desc | select * from <tablename1> order by <columnname1> desc | sort:<fieldname1> desc | http://url/select?indent=on&q=*:*&sort=<fieldname1>%20desc&wt=json |
3.MULTIPLE ORDERING
Used to sort the multiple fields in specific order.
DB syntax | DB query | Solr Syntax | Solr query |
group by <columnname1>,<columnname2> | select <columnname1>,<columnname2>from <tablename1> where <condition> group by <columnname1>,<columnname2> | facet=on&facet.pivot=<fieldname1>,<fieldname2> | http://url/select?facet=on&indent=on&q=*:*&wt=json&facet.pivot=<fieldname1>,<fieldname2> |
HAVING
Used to specify a condition on the grouped record
DB syntax | DB query | Solr Syntax | Solr query |
having | select <columnname1> from <tablename1> where <condition> group by <columnname1> having <condition> | facet=on&facet.mincount=<integervalue> | http://url/select?facet=on&indent=on&q=*:*&wt=json&facet.field=<fieldname1>&facet.mincount=< integervalue >
|
LOGICAL OPERATOR
1.AND
Return records when all the conditions are met.
DB syntax | DB query | Solr Syntax | Solr query |
and | select * from <tablename1> where <condition1> and <condition2> | fq=<fieldname1>:<value>&fq=<fieldname2>:<value> | http://url/select?fq=<fieldname1>:<value>&fq=<fieldname2>:<value>&indent=on&q=*:*&wt=json |
2.OR
Return records when any one of the conditions is met.
DB syntax | DB query | Solr Syntax | Solr query |
or | select * from <tablename1> where <condition>1 or <condition>2 | fq=<fieldname1>:(<value1> OR <value2>) | http://url/select?fq=<fieldname1>:(<value1>OR<value2>)&indent=on&q=*:*&wt=json |
3.AND and OR
Combination of AND and OR condition.
DB syntax | DB query | Solr Syntax | Solr query |
select * from <tablename1> where (<condition>1 and <condition>2) or <condition3> | fq=<fieldname1>:(<value1> OR <value2>)&fq=<fieldname2>:<value3> | http://url/select?fq=<fieldname1>:(<value1>OR<value2>)&fq=<fieldname2>:<value3>&indent=on&q=*:*&wt=json |
4.NEGATION
Return records when conditions are not met.
DB syntax | DB query | Solr Syntax | Solr query |
not | select * from <tablename1> where not <condition1> | fq=-<fieldname1>:<value1> | http://url/select?fq=-<fieldname1>:<value1>&indent=on&q=*:*&wt=json |
NULL
1.IS NULL
PostgreSQL: Return records where the columns contain a null value.
Solr: Return documents where fq field does not exists.
DB syntax | DB query | Solr Syntax | Solr query |
Is null | Select <fieldname1> from <tablename1> where <columname1> is null; | -fq= <fieldname1>:* | http://url/select?facet=on&-fq=<fieldname1>:*&indent=on&q=*:* &wt=json |
2.IS NOT NULL
PostgreSQL: Return records where the columns does not contain a null value.
Solr: Return documents where fq field exists.
DB syntax | DB query | Solr Syntax | Solr query |
is not null | Select <fieldname1> from <tablename1> where <columname1> is not null; | fq=<fieldname1>:* | http://url/select?facet=on& fq=<fieldname1>:*&indent=on&q=*:* &wt=json |
COMPARSION OPERATOR
1.LESS THAN
Return records lesser than the specified value.
DB syntax | DB query | Solr Syntax | Solr query |
< | select * from <tablename1> where <columnname1> < <value> | fq=<fieldname1>:{* TO <value>} | http://url/select? fq=<fieldname1>:{* TO <value>}&indent=on &q=*:*&wt=json |
2.GREATER THAN
Return records greater than the specified value.
DB syntax | DB query | Solr Syntax | Solr query |
> | select * from <tablename1> where <columnname1> > <value> | fq=<fieldname1>:{<value> TO *} | http://url/select?fq=<fieldname1>:{<value> TO *}&indent=on&q=*:*&wt=json |
3.LESS THAN OR EQUAL TO
Return records lesser than equal to the specified value.
DB syntax | DB query | Solr Syntax | Solr query |
<= | select * from <tablename1> where <columnname1> <= <value> | fq= <fieldname1>:[* TO <value>] | http://url/select? fq=<fieldname1>:[* TO <value>]&indent=on& q=*:*&wt=json |
4.GREATER THAN OR EQUAL TO
Return records greater than or equal to the specified value.
DB syntax | DB query | Solr Syntax | Solr query |
>= | select * from <tablename1> where <columnname1> >= <value> | fq= <fieldname1>:[<value> TO *] | http://url/select? fq=<fieldname1>:[<value> TO *]&indent=on& q=*:*&wt=json |
5.BETWEEN
Used to retrieve values equal and within a range.
DB syntax | DB query | Solr Syntax | Solr query |
Between <value1> and <value2> | select * from <tablename1> where <fieldname1> between 250 and 259 | fq= <fieldname1>:[1 TO 5] | http://url/select?fq=<fieldname1>:[1%20TO%205]&indent=on&q=*:*&wt=json |
6.EQUAL
Returns all the record equal to specified value.
DB syntax | DB query | Solr Syntax | Solr query |
= | select * from <tablename1> where <columnname1> = <value> | fq=<fieldname1>:<value> | http://url/select? fq=<fieldname1>:<value>&indent=on& q=*:*&wt=json |
LIKE
1.KEYWORD AT THE BEGINNING
PostgreSQL: Return records that has ‘keyword’ at the beginning.
Solr: Return records that has ‘keyword’ at the beginning. This work only for string type.
DB syntax | DB query | Solr Syntax | Solr query |
like ‘<keyword>%’ | select * from <tablename1> where <columnname1> like ‘<keyword>%’ | fq= <fieldname1>: <keyword>* | http://url/select? fq=<fieldname1>: <keyword>*& indent=on &q=*:*&wt=json |
2.KEYWORD AT THE END
PostgreSQL: Return records that has ‘keyword’ at the end.
Solr: Return records that has ‘keyword’ at the end. This work only for string type.
DB syntax | DB query | Solr Syntax | Solr query |
like ‘%<keyword>’ | select * from <tablename1> where <columnname1> like ‘%<keyword>’ | fq= <fieldname1>:*<keyword> | http://url/select? fq=<fieldname1>:* <keyword>& indent=on &q=*:*&wt=json |
3.KEYWORD IN-BETWEEN
PostgreSQL: Return records that has ‘keyword’ in any position.
Solr: Return records that has ‘keyword’ in any position. This work only for string type.
DB syntax | DB query | Solr Syntax | Solr query |
Like %<keyword>% | select * from <tablename1> where <columnname1> like ‘%<keyword>%’ | fq= <fieldname1>: *<keyword>* | http://url/select?fq=<fieldname1>:*<keyword>*&indent=on&q=*:*&wt=json |
OFFSET
Used to skip a fixed number of rows in the result.
DB syntax | DB query | Solr Syntax | Solr query |
offset < integervalue > | select * from <tablename1> offset < integervalue > | start=< integervalue > | http://url/select? indent=on& q=*:*&start=< integervalue >&wt=json |
LIMIT
Used to limit the data returned.
DB syntax | DB query | Solr Syntax | Solr query |
limit < integervalue > | select * from <tablename1> limit < integervalue > | rows=< integervalue > | http://url/select? indent=on&q=*:*&rows=< integervalue >&wt=json |
JOINS
1.INNER JOIN
PostgreSQL: Rows from both participating tables are considered to return on a match between the columns.
Solr: Rows from both participating collections are considered to return on a match between the fields.
DB syntax | DB query | Solr Syntax | Solr query |
<tablename1> inner join <tablename2> on <tablename1>.<columnname1> = <tablename2>.<columnname1>; |
Select * from <tablename1> inner join <tablename2> on <tablename1>.<columnname> = <tablename2>.<columnname>; | fq={!join from=<fromcollectionfieldname> to=<tocollectionfieldname> fromIndex=<collectionname2>}<fromcollectionfieldname>:<value> | http://url/select?fl=*&fq={!join%20from=<fromcollectionfieldname>%20to= <tocollectionfieldname>%20fromIndex=<collectionname2}<fieldname1>:<value>&indent=on& q=*:*&rows=10&wt=json |
2.SELF JOIN
PostgreSQL: Used to join or compare a table to itself.
Solr: Used to join or compare a collection to itself.
DB syntax | DB query | Solr Syntax | Solr query |
Select <columname1)> from <tablename1> t1, <tablename1> t2 |
Select <a.columnname>, <b.columnname> from <tablename1> a, <tablename1> b where <a.commonfield> = <b.commonfield>; | fq={!join from=<fieldname1> to=<fieldname1>}<fieldname1>:<value> | http://url/select?fl=*&fq={!join%20from=<fieldname1>%20to=<fieldname1>}<fieldname1>:<value>& indent=on& q=*:*&rows=10&wt=json |
TRIM
LEFT TRIM
PostgreSQL: Used to extract n number of characters specified in the argument from the left of a given string.
Solr: Used to extract the result irrespective of type.
DB syntax | DB query | Solr Syntax | Solr query |
left(<value>) | select left (<value>) | hl=true&hl.field=<fieldname1>&hl.alternateField=<fieldname1>&hl.maxAlternateFieldLength=2 | http://url/select?fl=<fieldname1>&indent=on&q=*:*& wt=json&hl=true&hl.field=<fieldname1>&hl.alternateField=<fieldname1>& hl.maxAlternateFieldLength=<value>& fq=<fieldname1>:* |
CONCATENATION
PostgreSQL: Used to concatenate two or more value.
Solr: Used to concatenate two or more value irrespective of type.
DB syntax | DB query | Solr Syntax | Solr query |
Concat(value1,value2) | select concat(<value1>,<value2>) | Concat(<fieldname1>,<fieldname2>) | http://url/select?concat(<fieldname1>,<fieldname2>)&indent=on&q=*:*&wt=json |
GREATEST
Return maximum value among arguments.
DB syntax | DB query | Solr Syntax | Solr query |
Greatest (value1,value2) | Select greatest (<value1>, <value2>) | fl= max(<fieldname1>, <fieldname2>) | http://url/select?fl=max(<fieldname1>,<fieldname2>)& indent=on& q=*:*&rows=20&wt=json |
LEAST
Return minimum value among arguments.
DB syntax | DB query | Solr Syntax | Solr query |
least(value1,value2) | Select least(<value1>, <value2>) | fl= min(<fieldname1>, <fieldname2>) | http://url/select?fl=min(<fieldname1>,<fieldname2>)& indent=on& q=*:*&rows=20&wt=json |
LENGTH
PostgreSQL: Return values with specified length
Solr: Return the length irrespective of any type.
DB syntax | DB query | Solr Syntax | Solr query |
length(<columnname1>) | Select <columnname1>, from <tablename1> where length(<columnname1>) <condition>; | fq=<fieldname1>: /.{<value>}.*/ | http://url/select? fq=<fieldname1>:/{<value>}.*/& indent=on& q=*:*&wt=json |
DATE
1.TO QUERY CURRENT DATE
DB syntax | DB query | Solr Syntax | Solr query |
current_date() | Select * from <tablename1> where <columnname1>=current_date | fq= <fieldname1>:NOW+0DAY/DAY | http://url/select? fq=<fieldname1>:NOW+0DAY/DAY& indent=on& q=*:*&wt=json |
2.TO QUERY ONE DAY BEFORE CUURENT DATE
DB syntax | DB query | Solr Syntax | Solr query |
current_date – interval ‘1 day’ | Select * from <tablename1> where <columnname1>= current_date – interval ‘1 day’ | fq= <fieldname1>:NOW-1DAY/DAY | http://url/select?fq=<fieldname1>:NOW-1DAY/DAY&indent=on&q=*:*&wt=json |
3.TO QUERY ONE DAY AFTER CUURENT DATE
DB syntax | DB query | Solr Syntax | Solr query |
current_date + interval ‘1 day’ | Select * from <tablename1> where <columnname1>= current_date + interval ‘1 day’ | fq= <fieldname1>:NOW+1DAY/DAY | http://url/select?fq=<fieldname1>:NOW+1DAY/DAY&indent=on&q=*:*& wt=json |
4.TO QUERY ONE MONTH BEFORE CUURENT DATE
DB syntax | DB query | Solr Syntax | Solr query |
current_date – interval ‘1 month’ | Select * from <tablename1> where <columnname1>= current_date – interval ‘1 month’ | fq= <fieldname1>:NOW-1MONTH/DAY | http://url/select?fq=<fieldname1>:NOW-1MONTH/DAY&indent=on&q=*:* &wt=json |
5.TO QUERY ONE MONTH AFTER CUURENT DATE
DB syntax | DB query | Solr Syntax | Solr query |
current_date + interval ‘1 month’ | Select * from <tablename1> where <columnname1>= current_date + interval ‘1 month’ | fq= <fieldname1>:NOW+1MONTH/DAY | http://url/select?fq=<fieldname1>:NOW+1MONTH/DAY&indent=on&q=*:*& wt=json |
6.TO QUERY ONE YEAR BEFORE CUURENT DATE
DB syntax | DB query | Solr Syntax | Solr query |
current_date – interval ‘1 year’ | Select * from <tablename1> where <columnname1>= current_date – interval ‘1 year’ | fq= <fieldname1>:NOW-1year/DAY | http://url/select?fq=<fieldname1>:NOW-1YEAR/DAY&indent=on&q=*:*& wt=json |
7.TO QUERY ONE YEAR AFTER CURRENT DATE
DB syntax | DB query | Solr Syntax | Solr query |
current_date + interval ‘1 year’ | Select * from <tablename1> where <columnname1>= current_date + interval ‘1 year’ | fq= <fieldname1>:NOW+1year/DAY | http://url/select?fq=<fieldname1>:NOW+1YEAR/DAY&indent=on&q=*:*& wt=json |
AGGREGATE FUNCTION
1.MIN
Return the smallest value of a field.
DB syntax | DB query | Solr Syntax | Solr query |
min (<columname1>) | select min(<columnname1>) from <tablename1> | stats=true&stats.field=<fieldname1> | http://url/select?indent=on&q=*:*&wt=json&stats=true&stats.field=<fieldname1> |
2.MAX
Return the maximum value of a field.
DB syntax | DB query | Solr Syntax | Solr query |
max (<columname1>) | select max(<columnname1>) from <tablename1> | stats=true&stats.field=<fieldname1> | http://url/select?indent=on&q=*:*&wt=json&stats=true&stats.field=<fieldname1> |
3.SUM
Return the sum of values of a field.
DB syntax | DB query | Solr Syntax | Solr query |
sum (<columname1>) | select sum(<columnname1>) from <tablename1> | stats=true&stats.field= <fieldname1> | http://url/select?indent=on&q=*:*&wt=json&stats=true&stats.field=<fieldname1> |
4. AVG
Return the average of values of a field.
DB syntax | DB query | Solr Syntax | Solr query |
avg(<columname1>) | select avg(<columnname1>) from <tablename1> | stats=true&stats.field=<fieldname1> | http://url/select?indent=on&q=*:*&wt=json&stats=true&stats.field=<fieldname1> |
ARITHMETIC OPERATORS
1.ADDITION
Used to add arguments.
DB syntax | DB query | Solr Syntax | Solr query |
(<value1> + <value2>) | select <value1>+<value2> | fl= sum(<value1>, <value2>) | http://url/select?fl=sum(<value1>,<value2>)&indent=on&q=*:*&wt=json |
2.SUBSTRACTION
Used to subtract arguments.
DB syntax | DB query | Solr Syntax | Solr query |
(<value>1 – <value>2) | select (<value1>-<value2>) | fl= sub(<value1>, <value2>) | http://url/select?fl=sub(<value1>,<value2>)&indent=on&q=*:*&wt=json |
3.MULTIPLICATION
Used to multiply arguments.
DB syntax | DB query | Solr Syntax | Solr query |
(<value>1 * <value>2) | select (<value1>*<value2>) | fl= product(<value1>, <value2>) | http://url/select?fl=product(<value1>,<value2>)&indent=on&q=*:*&wt=json |
4.DIVISION
Used to divide arguments.
DB syntax | DB query | Solr Syntax | Solr query |
(<value>1/ <value>2) | select (<value1>/<value2>) | fl= div(<value1>, <value2>) | http://url/select?fl=div(<value1>,<value2>)&indent=on&q=*:*&wt=json |
5.MODULUS
Returns the remainder after division of the first argument by the second one.
DB syntax | DB query | Solr Syntax | Solr query |
(<value1> % <value2>) | select (<value1>%<value2>) | fl= mod(<value1>, <value2>) | http://url/select?fl=mod(<value1>,<value2>)&indent=on&q=*:*&wt=json |
6.SQUARE ROOT
Returns the square root of a number.
DB syntax | DB query | Solr Syntax | Solr query |
|/ (<value>) | select |/ (<value>) | fl=sqrt(<value>) | http://url/select?fl=sqrt(<value>)&indent=on&q=*:*&wt=json |
7.CUBE ROOT
Returns the cube root of a number.
DB syntax | DB query | Solr Syntax | Solr query |
||/(<value>) | select ||/ (<value>) | fl=cbrt(<value>) | http://url/select?fl=cbrt(<value>)&indent=on&q=*:*&wt=json |
8.FACTORIAL
Returns the factorial of a number.
DB syntax | DB query | Solr Syntax | Solr query |
(<value>)! | select (<value>) ! | fl= factorial(<value>) | http://url/select?fl= factorial (<value>)&indent=on& q=*:*&wt=json |
9.ABSOLUTE
Returns the absolute value of a number.
DB syntax | DB query | Solr Syntax | Solr query |
abs(<value>) | select abs(<value>) | fl= abs(<value>) | http://url/select?fl= abs(<value>)&indent=on& q=*:*& wt=json |
10.CEIL
Returns the smallest integer value that is greater than or equal to a number.
DB syntax | DB query | Solr Syntax | Solr query |
ceil(<value>) | select ceil(<value>) | fl= ceil(<value>) | http://url/select?fl= ceil(<value>)&indent=on& q=*:*& wt=json |
11.FLOOR
Return the value after rounded up any positive or negative decimal as smaller than the argument.
DB syntax | DB query | Solr Syntax | Solr query |
floor(<value>) | select floor(<value>) | fl= floor(<value>) | http://url/select?fl= floor(<value>)&indent=on& q=*:*& wt=json |
12.ROUND
Return the nearest integer.
DB syntax | DB query | Solr Syntax | Solr query |
round(<value>) | select round(<value>) | fq=rint(<value>) | http://url/select?fl=rint(<value>)&indent=on&q=*:*&wt=json |
13.DEGREES
Returns the values in degrees from radian as specified in the argument.
DB syntax | DB query | Solr Syntax | Solr query |
degrees(<value>) | select degrees (<value>) | fl= degrees (<value>) | http://url/select?fl= degrees (<value>)&indent=on& q=*:*& wt=json |
14.RADIANS
Return the value in radian from degrees, provided in the argument.
DB syntax | DB query | Solr Syntax | Solr query |
radians(<value>) | select radians(<value>) | fq=rad(<value>) | http://url/select?fl= rad(<value>)&indent=on& q=*:*&wt=json |
15.EXP
Return the exponentiation of a number as specified in the argument.
DB syntax | DB query | Solr Syntax | Solr query |
exp(<value>) | select exp(<value>) | fl= exp(<value>) | http://url/select?fl= exp(<value>)&indent=on& q=*:*& wt=json |
16.LN
Return the natural logarithm of a given number, as specified in the argument.
DB syntax | DB query | Solr Syntax | Solr query |
ln(<value>) | select ln(<value>) | fl= ln(<value>) | http://url/select?fl= ln(<value>)&indent=on& q=*:*& wt=json |
17.LOG
Return the base 10 logarithm of a given number or logarithm of a number for a particular base, as specified in the argument.
DB syntax | DB query | Solr Syntax | Solr query |
log(<value>) | select log(<value>) | fl= log (<value>) | http://url/select?fl= log (<value>)&indent=on& q=*:*& wt=json |
18.pi
Return the constant of pi.
DB syntax | DB query | Solr Syntax | Solr query |
pi () | select pi() | fl= pi() | http://url/select?fl= pi()&indent=on& q=*:*& wt=json |
19.POWER
Return the of one number raised to the power of another number, provided in the argument.
DB syntax | DB query | Solr Syntax | Solr query |
power(<value1>,<value2>) | select power(<value1>,<value2>) | fq= pow(<value1>, <value2>) | http://url/select?fl= pow(<value1>,<value2>)&indent=on& q=*:*&wt=json |
TRIGONOMETRY FUNCTIONS
1.COS
Return the cosine of a given argument.
DB syntax | DB query | Solr Syntax | Solr query |
cos(<value>) | select cos(<value>) | fl=cos(<value>) | http://url/select?fl=cos(<value>)&indent=on&q=*:*&wt=json |
2.ACOS
Return the inverse cosine of a given argument.
DB syntax | DB query | Solr Syntax | Solr query |
acos(<value>) | select acos(<value>) | fl=acos(<value>) | http://url/select?fl=acos(<value>)&indent=on&q=*:*&wt=json |
3.SIN
Return the sine of a given argument.
DB syntax | DB query | Solr Syntax | Solr query |
sin(<value>) | select sin(<value>) | fl=sin(<value>) | http://url/select?fl=sin(<value>)&indent=on&q=*:*&wt=json |
4.ASIN
Return the inverse sine of a given argument.
DB syntax | DB query | Solr Syntax | Solr query |
asin(<value>) | select asin(<value>) | fl=asin(<value>) | http://url/select?fl=asin(<value>)&indent=on&q=*:*&wt=json |
5.TAN
Return the tangent of a given argument.
DB syntax | DB query | Solr Syntax | Solr query |
tan(<value>) | select tan(<value>) | fl=tan(<value>) | http://url/select?fl=tan(<value>)&indent=on&q=*:*&wt=json |
6.ATAN
Return the inverse tangent of a given argument.
DB syntax | DB query | Solr Syntax | Solr query |
atan (<value>) | select atan(<value>) | fl=atan(<value>) | http://url/select?fl=atan(<value>)&indent=on&q=*:*&wt=json |
Conclusion:
Please be cautious that, some of these solr queries could be little time and memory consuming , for instance, joining 2 different huge solr collections.
Also, note that not all the fields can be used for querying or be fetched in the result.This is determined by how the fields are configured in the schema.xml.So, if any of these queries are not working for any of your solr fields , do not forget to cross check your schema.xml.
Hope, this article helps to get comfortable with the solr syntax.
Please leave a comment if you have any queries.
This is an excellent handout for anyone to start with SOLR who has some knowledge in DB
Thanks Aneesh
Great Comparison!
Thanks Martin
Thanks Mani for putting this together. This is helpful and definitely would serve as reference whenever stuck with the solr query syntax.
Thanks Sharmi