Options
All
  • Public
  • Public/Protected
  • All
Menu

class Searcher Implements the required functionality to search for, and scrape Stack Overflow webpages to retrieve code snippets. Uses a combination of Goggle Custom Search Engine API and Jsoup to retrieve snippets.

Hierarchy

  • Searcher

Index

Constructors

constructor

Properties

Static NUM_ANSWERS_PER_URL

NUM_ANSWERS_PER_URL: any = 4

Static NUM_URLS

NUM_URLS: number = 3

Static activeFilePath

activeFilePath: string = ""

Static buffer

buffer: any = {}

Static cx

cx: string = "011454571462803403544:zvy2e2weyy8"

Static key

key: string = "AIzaSyClq5H_Nd7RdVSIMaRPQhwpG5m_-68fWRU"

Static status

status: boolean = false

Methods

Static contains

  • contains(query: string, text: string): boolean
  • Parameters

    • query: string
    • text: string

    Returns boolean

    either true or false Function which checks whether @param text exists inside @param query

Static findFileType

  • findFileType(): string
  • Returns string

    a string This function basically tries to analyze whether user wants python code or java code or something else.

Static getCodeObjects

  • getCodeObjects(topnAnswers: any): { code: any; quality: number }[]
  • Parameters

    • topnAnswers: any

      Function which just converts a code snippet string into a valid object

    Returns { code: any; quality: number }[]

Static getCodeSnippets

  • getCodeSnippets(urls: string[], type: string): Promise<any>
  • Parameters

    • urls: string[]
    • type: string

    Returns Promise<any>

Static getThreads

  • getThreads(query: string, type: string): Promise<string[]>
  • Parameters

    • query: string
    • type: string

    Returns Promise<string[]>

Static isExists

  • isExists(url: string, language: string): Promise<void>
  • Parameters

    • url: string
    • language: string

      Function which checks whether a high quality code snippet already exists or not based on Link and language

    Returns Promise<void>

Static replaceAll

  • replaceAll(qry: string, text: string, format: string): string
  • Parameters

    • qry: string
    • text: string
    • format: string

    Returns string

    a string Function which replaces characters

Static setTargetLanguage

  • setTargetLanguage(query: string, targetLang: string): string
  • Parameters

    • query: string
    • targetLang: string

    Returns string

Generated using TypeDoc