Skip to content

FabienO/LuceneQueryBuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lucene Query Builder

Installation

Composer

Add to composer.json:-

{
    "require": {
        "fabieno/lucenequerybuilder": "dev-master"
    }
}

Example usage

<?php
require_once 'vendor/autoload.php';

// initialise query instance
$query = new LuceneQueryBuilder\Query();

// URL matcher
$query->mayContain('Dr. Dre', 'title')
      ->mustContain('Next Episode', 'body')
      ->mustNotContain('Britney Spears', 'body')
      ->mayHaveInProximity('Snoop Dogg', 'body', 10)
      ->mustHaveInProximity('Eminem', 'body', 7);

// compile query - returns title: "Dr. Dre" AND body: (+"Next Episode" -"Britney Spears" "Snoop Dogg"~10 +"Eminem"~7)
$query->compile();

About

Lucene Query Builder for your easy lucene searching needs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages