Mercurial Hosting > luan
comparison src/luan/modules/lucene/Lucene.luan @ 1771:c62324841dfb
improve NumberFieldParser and add key map lucene query
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 25 Jun 2023 15:05:09 -0600 |
parents | 164c6ea53147 |
children |
comparison
equal
deleted
inserted
replaced
1770:6c01d54edcac | 1771:c62324841dfb |
---|---|
6 local type = Luan.type or error() | 6 local type = Luan.type or error() |
7 local set_metatable = Luan.set_metatable or error() | 7 local set_metatable = Luan.set_metatable or error() |
8 local get_local_cloned = Luan.get_local_cloned | 8 local get_local_cloned = Luan.get_local_cloned |
9 local set_local_cloned = Luan.set_local_cloned | 9 local set_local_cloned = Luan.set_local_cloned |
10 local pairs_local_cloned = Luan.pairs_local_cloned | 10 local pairs_local_cloned = Luan.pairs_local_cloned |
11 local stringify = Luan.stringify or error() | |
11 local Boot = require "luan:Boot.luan" | 12 local Boot = require "luan:Boot.luan" |
12 local Html = require "luan:Html.luan" | 13 local Html = require "luan:Html.luan" |
13 local Number = require "luan:Number.luan" | 14 local Number = require "luan:Number.luan" |
14 local integer = Number.integer or error() | 15 local integer = Number.integer or error() |
15 local Time = require "luan:Time.luan" | 16 local Time = require "luan:Time.luan" |
165 local doc | 166 local doc |
166 local function fn(_,doc_fn,_) | 167 local function fn(_,doc_fn,_) |
167 doc = doc_fn() | 168 doc = doc_fn() |
168 end | 169 end |
169 local total_hits = index.advanced_search(query,fn,1) | 170 local total_hits = index.advanced_search(query,fn,1) |
170 total_hits <= 1 or error("found "..total_hits.." documents for query: "..query) | 171 total_hits <= 1 or error("found "..total_hits.." documents for query: "..stringify(query)) |
171 return doc | 172 return doc |
172 end | 173 end |
173 | 174 |
174 function index.count(query) | 175 function index.count(query) |
175 return index.advanced_search(query) | 176 return index.advanced_search(query) |