Skip to content

Latest commit

 

History

History
95 lines (72 loc) · 3.48 KB

INDEX.md

File metadata and controls

95 lines (72 loc) · 3.48 KB

StArE.js Server version documentation.

Stare web search

Only public function exported from this package, follows this signature:

stare(engine, query, pageNumber, metrics) ⇒ Promise

Makes a request to the specified search engine which returns (callback), the SERP with the calculated metrics.

Kind: global function
Returns: Promise - An object with the standardized result page (SERP)

Param Type Description
engine string SERP to use [google|bing|ecosia|elasticsearch]
query string Search query
pageNumber number Page number in the result pages, starts at 1
metrics array Array with the name of the metrics to calculate

The way to call the function is as follows:

stare(engine, query, pageNumber, metrics);

/* Example */
stare('google', 'What is love?', 1, ['length', 'perspicuity']);

Options

let stareOptions = {
  /* Temporal files path, where the documents html/text 
  will be saved as an html/txt file. Must be relative path. */
  tempFilesPath: './temp/',
  
  /* Metrics modules/function created by the user */
  personalMetrics: {},
  resultsPerPage: 10,
  
  /* Google API */
  googleApiKey: process.env.GOOGLE_API_KEY || '',
  googleApiCx: process.env.GOOGLE_API_CX || '',
  
  /* Bing API */
  bingServiceKey: process.env.BING_SERVICE_KEY || '',
  
  /* ElasticSearch config */
  elasticsearch: {
    baseUrl: 'http://localhost:9200',
    _index: '_all',
    _source: '_source',
    titleProperty: 'title',
    snippetProperty: 'snippet',
    imageProperty: 'image'
  }
};
Property Type Description
tempFilesPath string Path to the user temporal folder
personalMetrics array Array of metric functions
googleApiKey string Google API Key for Custom Search
googleApiCx string Google API CX for Custom Search
bingServiceKey string Bing Service Key for Web Search
elasticsearch object ElasticSearch properties

Metrics Extensions

Metric Description Docs
language The language of the document See docs
length Length of the document which considers only the number of characters in the text of the document. See docs
perspicuity Perspicuity or Reading Ease (English) the document based on Flesh 1984 (en) and Szigriszt 1992 (es). See docs
ranking Ranking of the document in the query results pages (SERP), considering all the documents. See docs

For details on currently supported feature extractor/metrics extensions or how to create you own, see the docs for metrics.

SERP Extensions

SERP Name Requires API key Docs
Google google Yes See docs
Bing bing Yes See docs
Ecosia ecosia No See docs
ElasticSearch elasticsearch No See docs

For details on currently supported SERP extensions or how to create you own, see the docs for SERP.


Powered by jsdoc