Facebook DB Connector
Set-Up Instructions
Task 1 – Create a Database Collection in SearchBlox
After logging in to the Admin Console, select the Collections tab and click on Create a New Collection or "+" icon.
![Create.jpg 982](https://files.readme.io/a98ef1c-Create.jpg)
Next, Choose Database Collection as Collection Type.
![collection.png 1123](https://files.readme.io/17a0fc9-collection.png)
Enter a unique name, choose access type, choose the language and click Save to create the collection. This will add a database collection to the SearchBlox server.
Task 2 – Getting a OAuthAccess Token from Facebook
Go to https://developers.facebook.com/ and log in to your account.
Go to https://developers.facebook.com/tools/explorer and click Get Token and the dropdown Get User Access Token.
![img4-1-768x109.png 768](https://files.readme.io/3d7999f-img4-1-768x109.png)
In the resulting pop up, select all checkboxes and click Get Access Token.
![img5-1.png 554](https://files.readme.io/d50b581-img5-1.png)
Go to https://developers.facebook.com/tools/accesstoken/ and click the Debug button against User Token.
![img6-1-768x171.png 768](https://files.readme.io/e612230-img6-1-768x171.png)
Click Extend Access Token button.
![image (15).png 1082](https://files.readme.io/fa511ed-image_15.png)
Task 3 – Database Collection Settings
Select Facebook as the database type from the dropdown menu.
Enter the database URL string in the format as shown here:
jdbc:facebook:InitiateOAuth=GETANDREFRESH;
OR
jdbc:facebook:OAuthClientId=xxxx;OAuthAccessToken=CAACEdkkhdpkejodmdhkflde5evvtBQE2OdReTn5ffkVzTLjkstSkPsWxuA1cBu1hlrTXODyZBtC7VuE5ZAENxG389jkdflsju0lkjdBpjHbGCVkB7siA0lDZBI;
Enter the OAuthAccessToken from the developer page in the string.
Provide SQL Query to fetch the data from Facebook. The Query format is:
SELECT <index field> as uid , <column name2> as title, <column name3> as content FROM <tablename> LIMIT 100
Configure SQL Query
Some of the commonly used tables and common queries in Facebook are:
SELECT * FROM Posts
SELECT * FROM Comments
SELECT Id, Name, Picture FROM Likes
SELECT * FROM Users
SELECT * FROM Groups WHERE SearchTerms = ‘facebook’
SELECT * FROM Users WHERE SearchTerms = ‘facebook’
SELECT ID as uid,FromName as title FROM Wall WHERE Target = ‘facebook’For more data tables that can be indexed from Facebook, use the following links:
https://cdn.cdata.com/help/RBG/jdbc/pg_select.htm
https://cdn.cdata.com/help/RBG/jdbc/pg_systemtablesintro.htm
If you have more than 100 entries in a table, specify the number of documents to be indexed by providing the LIMIT value in the query. For example:
SELECT * FROM Wall LIMIT 300
Otherwise, a minimum of 100 rows will be indexed.
![save.jpg 1423](https://files.readme.io/668a7fe-save.jpg)
Save the settings. Click on Test Connection, you will be taken to Facebook Login page.
Check the settings by clicking the Test Database Collection. Note that the database connection has to be successful for the indexing to work.
Task 4 – Schedule and Index
Schedule indexing from the Schedule tab from Manage Collection page.
![Schedule 1.jpg 1573](https://files.readme.io/6f5d44c-Schedule_1.jpg)
After reaching the maximum number of documents, if continuous indexing is not required, click stop.
Search results in faceted search is shown here:
![search.jpg 1894](https://files.readme.io/35520c4-search.jpg)
![img13-1.png 721](https://files.readme.io/a74b703-img13-1.png)
Task 5 – Viewing Search Results in Kibana
Indexed content from Facebook can be visualized using Kibana.
The following example uses the maximum number of fields available in the data table account. The query to provide is
SELECT * FROM Groups WHERE SearchTerms = ‘facebook’
Steps in Kibana
1.Start Kibana.
How to start Kibana Visualizations
2. Add the collection ID.
![img15-768x286.png 768](https://files.readme.io/8f2b640-img15-768x286.png)
3. After adding the index, you can view the fields mapped.
![img16-768x337.png 768](https://files.readme.io/064fb86-img16-768x337.png)
4. Create visualizations by following the steps listed in the reference link, provided in the preceding Step 1.
A sample visualization generated for Facebook data indexed in SearchBlox:
![img17.png 768](https://files.readme.io/e7d552f-img17.png)
Updated over 2 years ago