PHP code example of xenos / asklucy

1. Go to this page and download the library: Download xenos/asklucy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xenos / asklucy example snippets



use AskLucy\Lucene;

$term = Lucene::term('word');


use AskLucy\Lucene;

$phrase = Lucene::phrase('Lucene query');


use AskLucy\Lucene;

$range = Lucene::range('alpha', 'omega');


use AskLucy\Lucene;

$phrase = Lucene::query()
    ->add(Lucene::term('word'))
    ->add(Lucene::phrase('Lucene query'));


use AskLucy\Lucene;

$term = Lucene::term('Lucene');
$term->setField('title');


use AskLucy\Lucene;

$term = Lucene::term('Lucene', 'title');


use AskLucy\Lucene;

$phrase = Lucene::phrase('Search Engine');
$phrase->setField('title');


use AskLucy\Lucene;

$phrase = Lucene::phrase('Search Engine', 'title');


use AskLucy\Lucene;

$range = Lucene::range('Anna', 'Doro');
$range->setField('name');


use AskLucy\Lucene;

$range = Lucene::range('Anna', 'Doro', 'name');


use AskLucy\Lucene;

$query = Lucene::query()
    ->add(Lucene::term('Lucene'))
    ->add(Lucene::term('Apache'));
$query->setField('title');


use AskLucy\Lucene;

$query = Lucene::query('title')
    ->add(Lucene::term('Lucene'))
    ->add(Lucene::term('Apache'));


use AskLucy\Lucene;

$query = Lucene::query()
    ->add(Lucene::term('Lucene', 'title'))
    ->add(Lucene::term('Apache'));


use AskLucy\Lucene;

$term = Lucene::term('PHP')
    ->


use AskLucy\Lucene;

$term = Lucene::term('Java')
    ->prohibited();


use AskLucy\Lucene;

$phrase = Lucene::phrase('Lucene query')
    ->


use AskLucy\Lucene;

$phrase = Lucene::phrase('Java development')
    ->prohibited();


use AskLucy\Lucene;

$range = Lucene::range('Anna', 'Doro')
    ->


use AskLucy\Lucene;

$range = Lucene::range('Anna', 'Doro')
    ->prohibited();


use AskLucy\Lucene;

$phrase = Lucene::query()
    ->add(Lucene::term('Lucene'))
    ->add(Lucene::phrase('search query'))
    ->


use AskLucy\Lucene;

$query = Lucene::query()
    ->shouldHave(Lucene::term('word'))
    ->mustHave(Lucene::phrase('Lucene query'))
    ->mustNotHave(Lucene::phrase('Java development'));


use AskLucy\Lucene;

$term = Lucene::term('Lucene');
$term->boost(2.5);

$phrase = Lucene::phrase('search engine')
    ->boost(2);

$query = Lucene::query()
    ->add(Lucene::term('Apache'))
    ->add($term)
    ->add($phrase);


use AskLucy\Lucene;

$term = Lucene::term('word')
    ->fuzzify();


use AskLucy\Lucene;

$term = Lucene::term('word')
    ->fuzzify(1);


use AskLucy\Lucene;

$phrase = Lucene::phrase('search term')
    ->setProximity(5);


use AskLucy\Lucene;

$range = Lucene::range('Alpha', 'Omega')
    ->inclusive();


use AskLucy\Lucene;

$range = Lucene::range('Alpha', 'Omega')
    ->exclusive();