Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5cf689e
adding .gitignore file
neowulf Feb 1, 2012
1797f65
initial commit of Hashr2 using maven and upgraded to Solr 3.4
neowulf Feb 1, 2012
c6b0a37
Upgrading solr/solr/webapps/solr.war to use solr 3.5
neowulf Feb 1, 2012
a4949a2
removing Hashr as an attempt to upgrade to Hashr2
neowulf Feb 1, 2012
14c48d7
* updating the pom file to generate a jar file with a more appropriat…
neowulf Feb 1, 2012
4d35003
adding readme for hashr2
neowulf Feb 1, 2012
795cfe8
removing logs and adding them to .gitignore
neowulf Feb 1, 2012
a328668
removing tilda file
neowulf Feb 1, 2012
d499438
renaming Hashr2 to hashr
neowulf Feb 1, 2012
97a11fc
adding original solrconfig_35.xml
neowulf Feb 6, 2012
5f49dad
bringing solrconfig.xml to the solrconfig.xml located in apache-solr-…
neowulf Feb 6, 2012
5f9d785
Added track info to json response
Dec 30, 2013
b0e4b3f
ignoring json files in util directory
danicuki Dec 31, 2013
46c7a71
Make API thread safe by locking tyrant
danicuki Jan 1, 2014
dc3aea9
add track_id without dash part
danicuki Jan 8, 2014
da09a99
Implemented delete behavior in API
danicuki Jan 11, 2014
8f5ec12
when first and second place have same score means that probably it is…
danicuki Jan 11, 2014
d89b7a6
command line code matcher.
danicuki Jan 11, 2014
f6a8ad7
accept more concurrent connections to jetty
danicuki Jan 18, 2014
1125140
add some missing fields to solr
danicuki Jan 18, 2014
2a52ce3
command line to match code based on stdin improvement
danicuki Jan 18, 2014
832e796
additional fields (genre, nitrate, sample_rate) to solr index
danicuki Jan 18, 2014
09d606f
gitignore some files
danicuki Jan 18, 2014
8df19fa
removed log from git
danicuki Jan 18, 2014
4430037
removed sold data from git
danicuki Jan 18, 2014
49f418a
ignore solr data files
Dec 31, 2013
7f02a2c
merge with solr35 branch
danicuki Jan 18, 2014
80743d5
fixing errors that not allowed solr run
danicuki Jan 18, 2014
fc10004
change solr parameters
danicuki Feb 1, 2014
706d263
fine running sold search to improve performance
danicuki Feb 6, 2014
a05f503
merge
danicuki Feb 7, 2014
f67168d
hashr added correctly
danicuki Feb 7, 2014
6654e19
git ignoring things
danicuki Feb 7, 2014
4d873ea
easily configurable server
danicuki Feb 27, 2014
f7d7043
solr logs to file and retain for fewer days
danicuki Apr 9, 2014
6f7da18
sold configured to be slave, fp configuration dividing tyrant and sol…
danicuki Apr 18, 2014
6bd9600
retain only 2 days of jetty logs
danicuki Jan 10, 2015
2e28bfe
release tyrant lock if error
danicuki Jan 13, 2015
53da6df
release tyrant lock if error
danicuki Jan 13, 2015
fed8980
release tyrant lock if error
danicuki Jan 13, 2015
b9809fb
release tyrant lock if error in all calls
danicuki Jan 13, 2015
8c50eae
put in solr only after puting in tyrant
danicuki Jan 17, 2015
d31973d
fix delete tracks in pytyrant
danicuki Jan 21, 2015
5af5388
log retention to 3 days
danicuki Apr 20, 2015
a81eda0
trying new approach with performatic int int hash
Aug 20, 2015
30cfc57
performance tuning
Aug 20, 2015
bc84615
print max doc just for test
Aug 31, 2015
45d5730
implementing using array position instead of hash
Aug 31, 2015
2c7ed0d
implementing fail over if array size is less than max doc. Re-build a…
Aug 31, 2015
d5f5425
log only 1 day because of size
Nov 24, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
solr/solr/logs/
solr/solr/data/
solr/solr/solr/index/
solr/solr/solr/spellchecker
*.pyc
*.swp
*.log
.idea/
**/target/
*.iml
.classpath
.project
.settings
.DS_Store
31 changes: 22 additions & 9 deletions API/api.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
except ImportError:
import simplejson as json


# Very simple web facing API for FP dist

urls = (
Expand All @@ -29,14 +28,15 @@

class ingest:
def POST(self):
params = web.input(track_id="default", fp_code="", artist=None, release=None, track=None, length=None, codever=None)
params = web.input(track_id="default", fp_code="", artist=None, release=None, track=None, length=None, codever=None, source=None, genre=None, bitrate=None, sample_rate=None)
print params
if params.track_id == "default":
track_id = fp.new_track_id()
else:
track_id = params.track_id
if params.length is None or params.codever is None:
return web.webapi.BadRequest()

# First see if this is a compressed code
if re.match('[A-Za-z\/\+\_\-]', params.fp_code) is not None:
code_string = fp.decode_code_string(params.fp_code)
Expand All @@ -45,31 +45,44 @@ def POST(self):
else:
code_string = params.fp_code

data = {"track_id": track_id,
data = {"track_id": track_id,
"fp": code_string,
"length": params.length,
"codever": params.codever }
if params.artist: data["artist"] = params.artist
if params.release: data["release"] = params.release
if params.track: data["track"] = params.track
if params.source: data["source"] = params.source
if params.genre: data["genre"] = params.genre
if params.bitrate: data["bitrate"] = params.bitrate
if params.sample_rate: data["sample_rate"] = params.sample_rate

fp.ingest(data, do_commit=True, local=False)

return json.dumps({"track_id":track_id, "status":"ok"})



class query:
def DELETE(self):
params = web.input(track_id="")
fp.delete(params.track_id.encode("utf-8"))

def POST(self):
return self.GET()

def GET(self):
stuff = web.input(fp_code="")
response = fp.best_match_for_query(stuff.fp_code)
track_info = {key: value for key, value in response.metadata.items()
if key != "import_date"}
if "track_id" in track_info.keys():
track_info["track_id"] = track_info["track_id"].split("-")[0]

return json.dumps({"ok":True, "query":stuff.fp_code, "message":response.message(), "match":response.match(), "score":response.score, \
"qtime":response.qtime, "track_id":response.TRID, "total_time":response.total_time})
"qtime":response.qtime, "track_id":response.TRID, "total_time":response.total_time, "track_info":track_info})


application = web.application(urls, globals())#.wsgifunc()

if __name__ == "__main__":
application.run()

Loading