Retrieve Information from Stack Exchange

To retrieve questions and answers from a Stack Exchange site, create a new fetch task by following these steps. The connector runs each fetch task automatically, based on the schedule that is configured in the configuration file.

To create a new Fetch Task

  1. Stop the connector.
  2. Open the configuration file in a text editor.
  3. In the [FetchTasks] section of the configuration file, specify the number of fetch tasks using the Number parameter. If you are configuring the first fetch task, type Number=1. If one or more fetch tasks have already been configured, increase the value of the Number parameter by one (1). Below the Number parameter, specify the names of the fetch tasks, starting from zero (0). For example:

    [FetchTasks]
    Number=1
    0=MyTask
  4. Below the [FetchTasks] section, create a new TaskName section. The name of the section must match the name of the new fetch task. For example:

    [FetchTasks]
    Number=1
    0=MyTask
    
    [MyTask]
  1. In the new section, ensure that you have set the parameters required to authenticate with Stack Exchange. The OAuth configuration tool (described in Configure OAuth Authentication) creates a file that contains these parameters, and you can include them in the connector's configuration file using the following syntax:

    [MyTask] < "oauth.cfg" [OAUTH]

    For more information about including parameters from another file, see Include an External Configuration File

  2. In the new section, set the SiteName parameter, which specifies the stack exchange site to retrieve data from.

  3. (Optional) In the new section, set some configuration parameters to choose the data to retrieve. For example:

    SearchQuery Set this parameter to ingest questions that contain the specified text.
    SearchHasAcceptedAnswer

    Specifies whether a question must have an accepted answer, in order to be ingested.

    • To ignore questions that do not have an accepted answer, set this parameter to TRUE.
    • To ignore questions that have an accepted answer, set this parameter to FALSE.

    If you do not set this parameter, both answered and unanswered questions are ingested.

    SearchFromDate Set this parameter to ignore questions that were created before the specified date.

    For Example:

    [MyTask]
    SiteName=stackoverflow
    SearchQuery=python dictionary
    SearchHasAcceptedAnswer=TRUE
    SearchFromDate=-3 months
    

    For a full list of configuration parameters that you can use, see Content Selection.

  4. Save and close the configuration file. You can now start the connector.