aboutsummaryrefslogtreecommitdiff
path: root/benchmark/testelasticsearch.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-04-12 14:27:10 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-04-12 14:27:10 +0200
commitae67e23af7993199391b962eca2cbecfe9f8a8d5 (patch)
treeeda41eb3a19cf705072c28c31d369f2dc2ca848f /benchmark/testelasticsearch.py
parentPrepare database initialization script for the new release. (diff)
downloadnewspipe-ae67e23af7993199391b962eca2cbecfe9f8a8d5.tar.gz
newspipe-ae67e23af7993199391b962eca2cbecfe9f8a8d5.tar.bz2
newspipe-ae67e23af7993199391b962eca2cbecfe9f8a8d5.zip
Removed benchmark scripts.
Diffstat (limited to 'benchmark/testelasticsearch.py')
-rw-r--r--benchmark/testelasticsearch.py57
1 files changed, 0 insertions, 57 deletions
diff --git a/benchmark/testelasticsearch.py b/benchmark/testelasticsearch.py
deleted file mode 100644
index accb8792..00000000
--- a/benchmark/testelasticsearch.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#! /usr/bin/env python
-#-*- coding: utf-8 -*-
-
-import elasticsearch
-from elasticsearch import client
-
-from pyaggr3g470r import utils
-
-# Connect to Elasticsearch node specified in the configuration file:
-es = elasticsearch.Elasticsearch(hosts={"127.0.0.1" : 9200})
-
-def delete_index():
- """
- Deletes all indexes.
- """
- es = elasticsearch.Elasticsearch(hosts={"127.0.0.1" : 9200})
- ic = client.IndicesClient(es.indices.client)
- try:
- ic.delete("")
- except:
- pass
-
-def create_index(articles):
- """
- Creates the index.
- """
- for article in articles:
- res = es.index(
- index="pyaggr3g470r",
- doc_type="text",
- id=str(article.id),
- body={
- "title": article.title,
- "content": utils.clear_string(article.content)
- }
- )
- return True
-
-def search(term):
- """
- Search a term.
- """
- try:
- es.search(index="pyaggr3g470r", body=
- {"query" : {
- "filtered" : {
- "query" : {
- "query_string" : {
- "default_field" : "content",
- "query" : term
- }
- }
- }
- }
- }, size=5000)
- except elasticsearch.exceptions.NotFoundError as e:
- pass \ No newline at end of file
bgstack15