All Projects → quebic-source → searchbox-core

quebic-source / searchbox-core

Licence: Apache-2.0 license
searchbox is a lightweight search framework built on redis

Programming Languages

java
68154 projects - #9 most used programming language
lua
6591 projects

Projects that are alternatives of or similar to searchbox-core

awesome-search-engine-optimization
A curated list of backlink, social signal opportunities, and link building strategies and tactics to help improve search engine results and ranking.
Stars: ✭ 82 (+272.73%)
Mutual labels:  search-engine
pia
📚 🔬 PIA - Protein Inference Algorithms
Stars: ✭ 19 (-13.64%)
Mutual labels:  search-engine
maricutodb
PHP Flat File Database Manager
Stars: ✭ 23 (+4.55%)
Mutual labels:  search-engine
instant-apps
Your search box is now an app store! 🎉
Stars: ✭ 93 (+322.73%)
Mutual labels:  search-engine
fleeg-platform
Fleeg is a free and open source platform to index and search pages.
Stars: ✭ 21 (-4.55%)
Mutual labels:  search-engine
seo-analyzer
The library for analyze a HTML file to show all of the SEO defects
Stars: ✭ 53 (+140.91%)
Mutual labels:  search-engine
x
Commerce Search & Discovery frontend web components
Stars: ✭ 54 (+145.45%)
Mutual labels:  search-engine
haro
Haro is a modern immutable DataStore
Stars: ✭ 24 (+9.09%)
Mutual labels:  search-engine
torrent-hound
Search torrents from multiple websites via the CLI
Stars: ✭ 28 (+27.27%)
Mutual labels:  search-engine
devsearch
A web search engine built with Python which uses TF-IDF and PageRank to sort search results.
Stars: ✭ 52 (+136.36%)
Mutual labels:  search-engine
yang-db
YANGDB Open-source, Scalable, Non-native Graph database (Powered by Elasticsearch)
Stars: ✭ 92 (+318.18%)
Mutual labels:  search-engine
react-search
This package will help you create a pretty good and beautiful search. And other related features
Stars: ✭ 17 (-22.73%)
Mutual labels:  search-engine
Verdant Search
用python+fastapi实现的搜索引擎
Stars: ✭ 13 (-40.91%)
Mutual labels:  search-engine
Openbud
When an open source project starts, it is normally accompanied by a single person and only when that person does a lot of work and gets the project up and running, do other open source contributors come to contribute. This project is to help these early projects to find other interested contributors to help when the project is in its early stage…
Stars: ✭ 14 (-36.36%)
Mutual labels:  search-engine
OpenSearch
🔎 Open source distributed and RESTful search engine.
Stars: ✭ 5,585 (+25286.36%)
Mutual labels:  search-engine
legitbot
🤔 Is this Web request from a real search engine🕷 or from an impersonating agent 🕵️‍♀️?
Stars: ✭ 18 (-18.18%)
Mutual labels:  search-engine
revery
A personal semantic search engine capable of surfacing relevant bookmarks, journal entries, notes, blogs, contacts, and more, built on an efficient document embedding algorithm and Monocle's personal search index.
Stars: ✭ 200 (+809.09%)
Mutual labels:  search-engine
booksearch
A Simple Search Engine to help you find FREE Download Links to your Favourite Books
Stars: ✭ 48 (+118.18%)
Mutual labels:  search-engine
docker
Official docker for Manticore Search
Stars: ✭ 39 (+77.27%)
Mutual labels:  search-engine
minimal-search-engine
最小のサーチエンジン/PageRank/tf-idf
Stars: ✭ 18 (-18.18%)
Mutual labels:  search-engine

searchbox

searchbox is a lightweight search framework built on redis.

searchbox

Prerequisities

  • JDK 1.8.X
  • Maven 3.3.X
  • Redis 2.6.X

Full Documentation

See the Wiki for full documentation, examples, operational details and other information.

Related Articles

Getting Started

  • Download the dependency then Install dependency by using mvn install
  • Add searchbox dependency into your project
  <dependency>
  	<groupId>com.quebic.searchbox</groupId>
  	<artifactId>searchbox-core</artifactId>
  	<version>1.0.0-SNAPSHOT</version>
  </dependency>

Sample application

  • Download the movies-search-app application from GitHub
  • Build the application using mvn package
  • Run the application using java -jar target\movies-search-app-0.0.1-SNAPSHOT.jar
  • Consume web app from localhost:1028

Stand up searchbox

@SpringBootApplication
@EnableSearchBox
public class App 
{
    public static void main( String[] args )
    {
    	SpringApplication.run(App.class, args);
    }
    
}
  • You can easily integrate searchbox with your Spring application by using @EnableSearchBox annotation.

configuration

  • Add some properties into ../src/main/resources/application.properties or ../src/main/resources/application.yml
  • appname is a required property. It is used to identify individual applications.
searchbox.appname = movies-search-app
  • Some of the optional properties.
searchbox.page.length =  # Search result page size. Default value is 10

server.host = # Http server host. Default value is localhost
server.port = # Http server port. Default value is 1028

redis.host = # Redis server host. Default value is localhost
redis.port = # Redis server port. Default value is 6379

Model Annotations

public class Movie {
	
	@Id
	@Index
	private int id;
	
	@Index
	private String title;
	
	@Index
	private String director;

	private int duration;
	
	...
  • @Id annotation is used to mention identity field of the model. Each model has a unique id.
  • @Index annotation is used to mention index fields of the model. Searching is perform only for index fields.

SearchBoxOperations

@RestController
@RequestMapping("/movies")
public class MovieController {
	
	@Autowired
	private SearchBoxOperations searchBoxOperations;
	
	...
	

insert,update and save

<T> void insert(T object) throws SearchBoxOperationsException
<T> void update(T object) throws SearchBoxOperationsException
<T> void save(T object) throws SearchBoxOperationsException
  • insert Check id is exists. Not allow for duplicate ids.
  • update Check id is exists. Then modify perticular model. Otherwise raised Id is not found exception.
  • save Check id is exists. If Id is exists update the model. Otherwise insert a new model.

search by field value

<T> SearchResult<T> searchByField(Class<T> cls, String field, Object searchValue, Page page) throws SearchBoxOperationsException;
  • example searchBoxOperations.searchByField(Movie.class, "id", id)

search by perfix value

<T> SearchResult<T> searchByFieldPerfix(Class<T> cls, String field, Object searchPrefix, Page page, boolean allWords) throws SearchBoxOperationsException;
  • example searchBoxOperations.searchByFieldPerfix(Movie.class, "title", "av") => ["Avatar", "Avengers", ...]

search by text pattern

<T> SearchResult<T> searchByFieldPattern(Class<T> cls, String field, String pattern, Page page) throws SearchBoxOperationsException;
  • example searchBoxOperations.searchByFieldPattern(Movie.class, "title", "*nic") => ["Titanic", ...]

Criteria Api

<T> SearchResult<T> search(Class<T> cls, Query query, Page page) throws SearchBoxOperationsException;
  • you can query your data with Criteria Api
  • example searchBoxOperations.search(Movie.class, new Query(Criteria.where("id").is(7)))

Query Functions

@QueryController
public class QueryFunctions {

	@QueryFunction("query1")
	public QueryHolder query1() throws Exception{
		
		Criteria c = Criteria
				.where("@parm_key").is("@parm_value");
		
		Query query = new Query(c);
		
		return new QueryHolder(Movie.class, query);
		
	}
	...
  • QueryFunctions are used PlaceHolders with '@' prefix to pass runtime values into query. Ex: @parm_key, @parm_value

  • Calling QueryFunctions by using SearchBoxOperations.

<T> SearchResult<T> search(String queryName, Map<String, Object> inputParms, Page page) throws SearchBoxOperationsException;
  • example
String queryName = "query1";
		
Map<String, Object> parms = new HashMap<>();
parms.put("parm_key", "title");
parms.put("parm_value", "Avatar");
	
searchBoxOperations.search("query1", parms);

Authors

License

  • This project is licensed under the Apache Licensed V2
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].