The YaCy Grid is the second-generation implementation of YaCy, a peer-to-peer search engine.The search results can be improved to a great extent by using YaCy-Grid as the new backend for SUSPER. YaCy Grid is the best choice for distributed search topology. The legacy YaCy is made for decentralised and also distributed network. While both the networks are distributed,the YaCy-Grid is centralized and legacy YaCy is decentralized. YaCy Grid facilitates a lot with scaling that will be in our hand and can be done in all aspects(loading, parsing, indexing) with computing power we choose. In YaCy,Solr is embedded. But in YaCy Grid,we will get elasticsearch cluster.They are both built around the core underlying search library Lucene.But elasticsearch will help us to scale almost indefinitely. In this blog, I will show you how to integrate YaCy Grid with Susper locally and how to use it to fetch results.
Implementing YaCy Grid with Susper:
Before using YaCy Grid we need to first setup YaCy Grid and crawl to url using crawl start API, more information about that can be found here Implementing YaCy Grid with Susper and Setting up YaCy Grid locally.
So, once we are done with setup and crawling, we need to begin using its APIs in Susper. Following are some easy steps in which we can show results from YaCy Grid in a separate tab is Susper.
Creating a service to fetch results:
In order to fetch results from local YaCy Grid server we need to create a service to fetch results from local YaCy Grid server. Here is the class in grid-service.ts which fetches results for us.
Modifying results.component.ts file
In order to get results from grid-service.ts in results.component.ts we must need to create an instance of the service and use this instance to get the results and store it in variables results.component.ts file and then use these variables to show results in results template. Following is the code that does this for us
Creating a New tab to show results from YaCy Grid:
Now we need to create a tab in the template where we can use local variables in results.component.ts to show the results following the current design pattern here is the code for that
Starting YaCy Grid Locally:
Now all we need is to start YaCy Grid server locally. To start it go in yacy_grid_mcp folder and use
This will start elasticsearch from its respective script.Next use
This will start RabbitMQ server with the required configuration.Next useThis will start elasticsearch from its respective script.Next use
To start YaCy Grid locally.
Now we are all done we just need to start Susper using
command and type a search query and move to YaCy_Grid tab to see results from YaCy Grid Server.
Here is the image which shows results from YaCy Grid in Susper