What is the syntax of the SQL query given in the SearchBlox Database collection?

The SQL query given in the SearchBlox Database collection has the same syntax as standard SQL query; however, a few additional details are required for SearchBlox to process results. A sample table with sample queries is listed below:

Table Name : Sample
@@@
-----------------------------------------------------------------------------
| no| fname | lname | address | dept | deptid |university|
|---------------------------------------------------------------------------|
| 1 | Smith | Jones | 1, Georgetown | Biotech | D05 | VCU |
| 2 | James | Brown | 5, Nearville | Physics | D01 | VCU |
| 3 | Will | Smith | 3, Napatown | Bioinfo | D04 | VCU |
| 4 | Gene | Rider | 4, Downey lane | Chemistry | D02 | VCU |
| 5 | Winny | George| 12, Brent road | Bioinfo | D04 | VCU |
| 6 | Minny | Greg | 2, Gregory lane| Mathematics| D03 | CMU |
| 7 | Andy | Allen | 5, Lincoln road| Mathematics| D03 | CMU |
| 8 | Mindy | Grey | 3, Vine corner | Physics | D01 | CMU |
-----------------------------------------------------------------------------
@@@

The query entered should be in the format below, given the above sample table
@@@
I. select *,no as “uid” from sample;
@@@
*Description:* This query will give the index no of results in the search result page when given any value from the table as a search term
@@@
II. Select no as “uid” , fname as “title”, lname as “content” from sample;
@@@
*Description:* This query will give the title and content in the search result with the title value in the search result link.
@@@
III. Select *,no as “uid”,lname as “title” from sample;
@@@
*Description:* This query will give the title in the search result link and all other values in the content as per the search made.

You can use a column directly or assign other column names to any other required field name in the query as provided above.

*Example search results output will be as follows based on the SQL entered:*

For the search term “smith”, the following would be returned in the JSON search results:
@@@
'[{"uid":"1","lname":"Jones","university":"VCU","keywords":"joe","no":"1","content":"[1, Smith,
Jones, 1, Georgetown, Biotech, D05, VCU]","title":"Smith","deptid":"D05","address":"1,
Georgetown","dept":"Biotech","fname":"Smith"}]'
@@@

Have more questions? Submit a request

Comments