Giter Site home page Giter Site logo

jeroenverfallie / solr-query-builder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from frne/solr-query-builder

0.0 2.0 1.0 778 KB

A simple PHP library to build Apache Solr queries

Home Page: https://github.com/swiss-php-friends/solr-query-builder

PHP 100.00%

solr-query-builder's Introduction

Solr Query Builder Build Status Scrutinizer Code Quality Latest Stable Version License

A simple PHP library to build Apache Solr queries

Features

  • Fluid query-builder API
  • Wildcard support
  • Fuzzy search
  • Integer- and string-range support
  • Fully unit-tested
  • Solr version support (3 & 4)

Installation

Use composer:

composer.phar require swiss-php-friends/solr-query-builder

Usage

The library provides a simple, fluid query builder. E.g.:

use SPF\SolrQueryBuilder\QueryBuilder;
use SPF\SolrQueryBuilder\Query\QueryInterface

$qb = new QueryBuilder;

// simple wildcard query
$query = $qb->select()
    ->where('text_en', 'foo')
    ->orWhere('text_en', 'bar', QueryInterface::WILDCARD_SURROUNDED)
    ->getQueryString();
    
// nesting
$query = $qb->select()
    ->nest()
        ->where('text_de', 'foo')
        ->andWhere('text_en', 'bar')
    ->endNest()
    ->orWhere('id', 2)
    ->getQueryString();

// value building (e.g. fuzzy-search or ranges)
$query = $qb->select()
    ->where('text_de', $qb->createFuzzySearchValue('foo', 0.7))
    ->orWhere('text_en', $qb->createStringRange('bar', 'baz'))
    ->orWhere('id', $qb->createNumericRange(10, 100))
    ->getQueryString();

Documentation

For a complete function reference see the API-Docs.

The tests also provide a good overview of the query builder and hot it works.

May the coverage-report provide you with some more information...

Contribution

You are very welcome to contribute. Report bugs and feature-requests to the GitHub Issue Tracking, or propose a PullRequest.

For contributions, please use the Symfony Coding Standard and write unit-tests.

Release Notes

See GitHub Releases

solr-query-builder's People

Contributors

frne avatar jeroenverfallie avatar

Watchers

James Cloos avatar  avatar

Forkers

tosintech-web

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.