定制 makinacorpus/php-lucene 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

makinacorpus/php-lucene

最新稳定版本:1.2.1

Composer 安装命令:

composer require makinacorpus/php-lucene

包简介

Minimalistic, feature-rich, PHP Lucene syntax query builder

README 文档

README

This is a very small piece of API that brings a query builder for building Lucene queries; use cases are numerous, the two most obvious ones being Elastic Search and Apache SolR.

Examples

use MakinaCorpus\Lucene\Query;

$query = new Query();

$query
    ->createTermCollection(Query::OP_OR)
    ->add("foo")
    ->add("bar")
;

$query
    ->createDateRange()
    ->setInclusive()
    ->setRange('1983-03-22', new \DateTime())
;

$query
    ->matchTerm('some_field', 'some value', null, 0.8)
    ->matchTerm('other_field', 'some_other_value', 1.3)
;

Should give you the following query:

(
    (foo OR bar)
    AND my_date_field:["1983\-03\-22T00\:00\:00\+0000" TO "2016\-06\-29T13\:10\:20\+0000"]
    AND some_field:"some value"~0.8
    AND other_field:some_other_value^1.3
)

Current status

This API is in use in various projects for now almost 10 years, although this version being a full refactor (mostly classes being renamed) that now runs in production for 6 months.

It's probably not bug free, and lacks some testing, yet until now it works.

统计信息

  • 总下载量: 4.91M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 3
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-01-04