Python 如何使用elasticsearch/lucene使用有限状态传感器使提前输入/提示搜索更快
我正在尝试构建类型先行搜索以下数据 ID DATA STRING id_1 "this is line number one" id_2 "this is line number two" ID数据字符串 id_1“这是第一行” id_2“这是第二行” 查询这些数据时,我将给出如下字符串: "line one" --> output: id_1 (ID of matching string) "two line" --> output: id_2 "this is line num" --> output id_1 id_2 (multiple results) “第一行”-->输出:id_1(匹配字符串的id) “两行”-->输出:id_2 “这是行数”-->输出id_1 id_2(多个结果) 我尝试为数据字符串中的每个标记使用带n个字符(前缀)的反向索引。但对于大型数据集,索引n-gram的速度很慢(查询在某种程度上已经足够好了)。 现在我在谷歌搜索的时候有了一些想法,lucene有一个Suggester类,它在类型先行搜索中非常快,并且使用FST(有限状态转换器)来实现快速前缀搜索 如何在我的场景中使用FST来加快键入前搜索?Python 如何使用elasticsearch/lucene使用有限状态传感器使提前输入/提示搜索更快,python,lucene,typeahead,search-suggestion,fst,Python,Lucene,Typeahead,Search Suggestion,Fst,我正在尝试构建类型先行搜索以下数据 ID DATA STRING id_1 "this is line number one" id_2 "this is line number two" ID数据字符串 id_1“这是第一行” id_2“这是第二行” 查询这些数据时,我将给出如下字符串: "line one" --> output: id_1 (ID of matching string) "two line" --> output: id_2 "this