Skip to content

Commit

Permalink
Removing flat references
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Whitman committed Mar 2, 2011
1 parent 24e5888 commit 64d7969
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
5 changes: 3 additions & 2 deletions API/api.py
@@ -1,9 +1,10 @@
#!/usr/bin/env python
# encoding: utf-8
"""
run.py
api.py
Created by Brian Whitman
Created by Brian Whitman on 2010-06-16.
Copyright (c) 2010 The Echo Nest Corporation. All rights reserved.
"""
from __future__ import with_statement

Expand Down
10 changes: 4 additions & 6 deletions API/fp.py
Expand Up @@ -103,7 +103,7 @@ def _get_actual_score(args):

# Given a query code string of any type (space sep, compressed, hexed, etc), find the best match from the FP flat (or local, or alt.)
# Do all the elbow stuff, time matching, etc. This is called directly by the API.
def best_match_for_query(code_string, elbow=8, which_flat="fp", local=False):
def best_match_for_query(code_string, elbow=8, local=False):
# DEC strings come in as unicode so we have to force them to ASCII
code_string = ascii(code_string)
tic = int(time.time()*1000)
Expand All @@ -120,7 +120,7 @@ def best_match_for_query(code_string, elbow=8, which_flat="fp", local=False):
return Response(Response.NOT_ENOUGH_CODE, tic=tic)

# Query the FP flat directly.
response = query_fp(code_string, rows=10, which_flat=which_flat, local=local)
response = query_fp(code_string, rows=10, local=local)
logger.debug("solr qtime is %d" % (response.header["QTime"]))

if len(response.results) == 0:
Expand Down Expand Up @@ -295,14 +295,12 @@ def delete(track_ids, commit=True, local=False):
print "not implemented yet"
return

fp_host = get_fp_flat_host(which_flat)

_fp_solr.delete_many(track_ids)
if commit:
commit()


def ingest(code_string_dict, commit=True, which_flat="fp", local=False):
def ingest(code_string_dict, commit=True, local=False):
# ingest doc into fp flat. input is a dict like {"TR12345":"10 1230 19 10203 123 40240", "TR12346":"10 1938 1928 4393 2032"}
if local:
return local_ingest(code_string_dict)
Expand All @@ -318,7 +316,7 @@ def ingest(code_string_dict, commit=True, which_flat="fp", local=False):
def commit(local=False):
_fp_solr.commit()

def query_fp(code_string, rows=15, which_flat="fp", local=False):
def query_fp(code_string, rows=15, local=False):
if local:
return local_query_fp(code_string, rows)

Expand Down
6 changes: 1 addition & 5 deletions API/store.py
Expand Up @@ -7,11 +7,7 @@

# If running locally just have this be localhost.
# If not change at will
#node = "174.129.90.114"
#node = "127.0.0.1"
#node = '174.129.156.231'
#node = '204.236.209.128'
node = '204.236.252.174'
node = '127.0.0.1'
_nodes = [node+":7705"]

# Holds or persisted connections (until close() is called)
Expand Down
1 change: 1 addition & 0 deletions README
@@ -0,0 +1 @@
Server components for Echoprint. In progress.

0 comments on commit 64d7969

Please sign in to comment.