How to index data from Facebook in SearchBlox?

How to Index Data From Facebook in SearchBlox

Setup Instructions

Task 1 – Create a Database Collection in SearchBlox

Log in to the SearchBlox server via the web interface. Once logged in, adding a collection only takes three clicks.

First, on the SearchBlox admin home screen, click the Add Collection button. The button is located near the top of the screen, just below navigation.

img1

After starting the process of adding a database collection, the next step is to name the collection. SearchBlox collection names are case sensitive and do not allow for either spaces or certain punctuation marks. However, the SearchBlox collection namespace is limited to each server install, which makes naming collections easier. Select Database Collection as the Collection Type.

img2

After naming the collection and selecting Database Collection as the collection type, specify the language or click the Add button. This will add a database collection to the SearchBlox server.

Task 2 – Providing an SQL Query

To fetch data from Facebook, a query must be provided. The query format is shown below.

SELECT <index field> as uid , <column name2> as title, <column name3> as content FROM <tablename> LIMIT 100

Some of the commonly used tables and common queries for the same in Facebook

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 links below:

http://cdn.cdata.com/help/RFA/jdbc/pg_alltables.htm

http://cdn.cdata.com/help/RBA/jdbc/pg_allviews.htm

img3

If you have more than 100 entries in a table (eg: Wall), 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.

Task 3 – 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

In the resulting pop up, select all checkboxes and click Get Access Token.

img5

Go to https://developers.facebook.com/tools/accesstoken/ and click the Debug button against User Token.

img6

Click Extend Access Token button.

img7

Task 4 – Database Collection Settings

  1. Select the database type as Facebook from the dropdown menu.
  2. Enter the database URL string in the format below:

jdbc:facebook:OAuthAccessToken=CAACEdkkhdpkejodmdhkflde5evvtBQE2OdReTn5ffkVzTLjkstSkPsWxuA1cBu1hlrTXODyZBtC7VuE5ZAENxG389jkdflsju0lkjdBpjHbGCVkB7siA0lDZBI;

Enter the OAuthAccessToken from the developer page in the string.

img8

  1. Save the settings.
  2. Check the settings by clicking the Test Database Collection Please note that the database connection has to be successful for the indexing to work.

img9

Task 6 – Index and Search

Start indexing from the Index tab or dashboard.

img10

After reaching the maximum number of documents, if continuous indexing is not required, click stop.

Search results in regular search and faceted search are shown as follows:

img8

img12

img13

Task 7 – Viewing Search Result in Kibana

Indexed content from Facebook can be visualized using Kibana.

The example below uses the maximum number of fields available in the data table account. The query to provide is

SELECT * FROM Groups WHERE SearchTerms = ‘facebook’

img14

Steps in Kibana

1.Start Kibana.

How to start Kibana?

2. Add the collection ID.

img15

3. After adding the index, the fields mapped can be viewed.

img16

4. Create visualizations by following the steps listed in the reference link, provided in Step 1 above.

A sample visualization generated for Facebook data indexed in SearchBlox:

img14

 

 

Back to Top