Coder Social home page Coder Social logo

codingreefdev / firehunt Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 5.78 MB

Search your firebase with ease using our FireHunt.

Home Page: https://firehunt.codingreef.com

License: Apache License 2.0

JavaScript 100.00%
firehunt firebase search-firebase search search-algorithm firebase-search firebase-realtime-database firebase-firestore-database firebase-firestore

firehunt's Introduction

Welcome to Fire Hunt

FireHunt is an open-source project to full-text search your firebase.

With FireHunt you can search your firebase without any difficulty. We currently only support JavaScript searches and will soon support all languages that support firebase.

Try Before Use

You can try our example online. Link To The Example.

How To Install

You will need to install Git Bash.

Then, let's clone the GitHub repository.

git clone https://github.com/CodingReef/FireHunt.git

Or you can just add the following code snippet in the head tag of your HTML file.

<script src="https://codingreefdev.github.io/FireHunt/Src/FireHunt.js" ></script>

Function To Query

First, make a file in your file directories called FireHunt.json and paste your firebase web app's SDK inside that file.

Then, make an instance of the library's class to search your firebase.

FOR FIRESTORE

var firehuntFS = await new FireHunt_FireStore();

FOR REAL-TIME DATABASE

var firehuntRT = await new FireHunt_RealTimeDB();

Here, we are using await so, make sure to use an async function.

Then, you can use the following Functions.

The following are supported by the FireStore class

await firehuntFS.init();
await firehuntFS.searchKey({ collection: "", key: ""}).then( searchResults => {console.log(searchResults )});
await firehuntFS.searchValue({ collection: "", value: ""}).then(searchResults =>{console.log(searchResults )});

NOTE: All the calls use await so make sure to use an async function. We use await because the fetching of data from firebase takes time.

await firehuntFS.init(); (Required)

This initializes your firebase app. Just make sure to use an async function and that you have your firebase SDK in a file called FireHunt.json.

await firehuntFS.searchKey({ collection: "", key: ""}).then( searchResults => {console.log(searchResults )});

This call is used to search your firebase for the key values in your firebase documents.

Pass the following parameters in a JSON format.

collection: the path for your collection.

key: the basic text to search your collection.

Please Note:

  • Don't forget to use await.
  • This searches only the collection and not the sub-collections.
  • This not only searches your document name but also the data inside the documents.
  • And only .then can be used to get the results.

await firehuntFS.searchValue({ collection: "", value: ""}).then(searchResults =>{console.log(searchResults )});

This call is used to search your firebase for the value - values in your firebase documents.

Pass the following parameters in a JSON format.

collection: the path for your collection.

value: the basic text to search your collection.

Please Note:

  • Don't forget to use await.
  • This searches only the collection and not the sub-collections.
  • This not only searches your document name but also the data inside the documents.
  • And only .then can be used to get the results.

The following are supported by the Realtime Database class

await firehuntRT.init();
await firehuntRT.searchKey({ path: "", key: "" }).then(searchResults => { console.log(searchResults) });
await firehuntRT.searchValue({ path: "", key: "" }).then(searchResults => { console.log(searchResults) });

NOTE: All the calls use await so make sure to use an async function. We use await because the fetching of data from firebase takes time.

await firehuntRT.init(); (Required)

This initializes your firebase app. Just make sure to use an async function and that you have your firebase SDK in a file called FireHunt.json.

await firehuntRT.searchKey({ path: "", key: "" }).then(searchResults => { console.log(searchResults) });

This call is used to search your firebase for the key values in your firebase (All the keys starting from that path).

Pass the following parameters in a JSON format.

path: the path for your destination to start searching from (The Directory).

key: the basic text to search for the key values in your real-time database.

Please Note:

  • Don't forget to use await.
  • This searches all the data starting from the path.
  • And only .then can be used to get the results.

await firehuntRT.searchValue({ path: "", key: "" }).then(searchResults => { console.log(searchResults) });

This call is used to search your firebase for the value - values in your firebase (All the values starting from that path).

Pass the following parameters in a JSON format.

path: the path for your destination to start searching from (The Directory).

value: the basic text to search for the value-values in your real-time database.

Please Note:

  • Don't forget to use await.
  • This searches all the data starting from the path.
  • And only .then can be used to get the results.

What's Next?

Now, you can use the API to search Firebase. Soon we will be uploading a template to show search results to your users. Till then you can try creating your own. Thanks for using FireHunt!!!.

Want to contribute?

Contribution to this project is open for all. Have something to show or have an upgrade you can contribute it all. Create a pull request and get started. More On Pull Requests.

firehunt's People

Contributors

vigneshkumar212 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.