pucene/index

Index package for pucene.

0.1.x-dev 2022-12-31 22:17 UTC

This package is auto-updated.

Last update: 2024-03-29 04:46:55 UTC


README

The index is the main entry point for pucene. It analyses, stores and searches for documents.

To store the documents it uses a driver which is independent and the reference implementation is done in pucene/dbal-driver.

This is a subtree split of the pucene/pucene project create issues in the main repository.

Usage

<?php

use Pucene\Analysis\StandardAnalyzer;
use Pucene\Index\Driver\MemoryDriverFactory;
use Pucene\Index\PuceneIndexFactory;
use Schranz\Search\SEAL\Schema\Index;
use Schranz\Search\SEAL\Schema\Field;

$driverFactory = new MemoryDriverFactory();

$indexFactory = new PuceneIndexFactory(
    $driverFactory,
    new StandardAnalyzer(),
);

$index = $indexFactory->create(new Index('blog', [
    'id' => new Field\IdentifierField('id'),
    'title' => new Field\TextField('title'),
]));