Package: hoppysearch
hoppysearchhoppysearch - Python client for hoppysearchRequirements.Python 2.7 and 3.4+Installation & Usagepip installInstall it via:pipinstallhoppysearchThen import the package:fromhoppysearchimportHoppySearch,ApiExceptionGetting StartedPlease follow theinstallation procedureand then run the following:Initial configuration:fromhoppysearchimportHoppySearch,ApiExceptionindex_id=YOUR_INDEX_IDapi_key=YOUR_API_KEYhoppysearch=HoppySearch(index_id,api_key)indexPlease add the below code after Initial configuration to index your data.documents=[{"Id":101872,"ProductId":"B000DZH1D6","UserId":"A1HKBX2L0DV258","ProfileName":"Dena Leasure","HelpfulnessNumerator":0,"HelpfulnessDenominator":0,"Score":5,"Time":1259625600,"Summary":"Gluten free cookies","Text":"These are the best cookies I have found that are gluten free.  I love them!"}]optionals={"configType":"create","diag":"true"}try:response=hoppysearch.index(documents,optionals)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)The second argument of hoppysearch.index is not mandatory. You can skip it fully or you can skip any key value according to your requirement.# skip second argumentdocuments=[{"Id":101872,"ProductId":"B000DZH1D6","UserId":"A1HKBX2L0DV258","ProfileName":"Dena Leasure","HelpfulnessNumerator":0,"HelpfulnessDenominator":0,"Score":5,"Time":1259625600,"Summary":"Gluten free cookies","Text":"These are the best cookies I have found that are gluten free.  I love them!"}]try:response=hoppysearch.index(documents)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)# skip some key of second argumentdocuments=[{"Id":101872,"ProductId":"B000DZH1D6","UserId":"A1HKBX2L0DV258","ProfileName":"Dena Leasure","HelpfulnessNumerator":0,"HelpfulnessDenominator":0,"Score":5,"Time":1259625600,"Summary":"Gluten free cookies","Text":"These are the best cookies I have found that are gluten free.  I love them!"}]optionals={"diag":"true"}try:response=hoppysearch.index(documents)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)You can pass file object or file path to upload data to index.# filepathdocuments="C:/Users/Pragyan/Desktop/books.json"try:response=hoppysearch.index(documents)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)# fileobjdocuments=open("C:/Users/Pragyan/Desktop/books.json","r")try:response=hoppysearch.index(documents)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)searchFirst add the configuration as mentioned above and then add below code to search.query="cookies"optionals={"searchableKeyList":"Summary, Text","diag":"true","showStats":"true","pageSize":10,"pageIndex":0}try:response=hoppysearch.search(query,optionals)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)The second argument of hoppysearch.search is not mandatory. You can skip it fully or you can skip any key value according to your requirement.# skip second argumentquery="cookies"try:response=hoppysearch.search(query)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)# skip some key of second argumentquery="cookies"optionals={"searchableKeyList":"Summary, Text","pageSize":10,"pageIndex":0}try:response=hoppysearch.search(query)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)luceneSearchFirst add the configuration as mentioned above and then add below code to perform search in advaced way.luceneQuery="Text: cookies"optionals={"defaultKeyNameToBeSearch":"Summary","analyzerClass":"org.apache.lucene.analysis.standard.StandardAnalyzer","diag":True,"showStats":True,"pageSize":10,"pageIndex":0}try:response=hoppysearch.lucene_search(luceneQuery,optionals)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)The second argument of hoppysearch.lucene_search is not mandatory. You can skip it fully or you can skip any key value according to your requirement.# skip second argumentluceneQuery="Text: cookies"try:response=hoppysearch.lucene_search(luceneQuery)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)# skip some key of second argumentluceneQuery="Text: cookies"optionals={"defaultKeyNameToBeSearch":"Summary","pageSize":10,"pageIndex":0}try:response=hoppysearch.lucene_search(luceneQuery,optionals)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)deleteFirst add the configuration as mentioned above and then add below code to delete specific data from index.hs_guid="15b522d8-1545-4dc9-9160-0b512f7d6997"optionals={"diag":True,"showStats":True}try:response=hoppysearch.delete(hs_guid,optionals)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)The second argument of hoppysearch.delete is not mandatory. You can skip it fully or you can skip any key value according to your requirement.# skip second argumenths_guid="15b522d8-1545-4dc9-9160-0b512f7d6997"try:response=hoppysearch.delete(hs_guid)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)# skip some key of second argumenths_guid="15b522d8-1545-4dc9-9160-0b512f7d6997"optionals={"diag":True}try:response=hoppysearch.delete(hs_guid,optionals)print(response)exceptApiExceptionase:print("Exception:%s\n"%e)statsFirst add the configuration as mentioned above and then add below code to get stats.try:response=hoppysearch.stats()print(response)exceptApiExceptionase:print("Exception:%s\n"%e)clearIndexFirst add the configuration as mentioned above and then add below code to clear all data from your index.try:response=hoppysearch.clear_index()print(response)exceptApiExceptionase:print("Exception:%s\n"%e)