搜索大型字符串列表的最快方法(使用通配符功能) [英] Quickest way to search a large list of strings (with wildcard functionality)
问题描述
您好,
我目前正在寻找一种方法让用户使用通配符搜索大量字符串列表(至少400,000)并可能提供自动完成(这不是必需的)。
类似
*测试
将返回以test结尾的所有字符串。
我调查了不同类型的搜索包括一个trie设置,但我不知道这些是否提供了通配符功能,或者它们是否需要一个实际的前缀来使用?
一些源代码示例我'已下载似乎需要一个前缀。
任何建议将不胜感激。
谢谢
Hello,
I'm currently looking to provide a way for users to search a large list of strings (at least 400,000) using wildcards and possibly provide auto completion (this is not essential).
Something like
*test
Would return all the strings that end in "test" for example.
I've investigated looking into different types of searches including a trie setup, but I can't tell if these provide wildcard functionality or if they need an actual prefix to work with?
A few source code examples I've downloaded seem to require a prefix.
Any advice would be greatly appreciated.
Thanks
推荐答案
您需要创建倒排索引或使用像lucene这样的组件: https:// lucenenet .apache.org / [ ^ ]
或我的文章hOOt: hOOt - 全文搜索引擎 [ ^ ]
You need to create inverted indexes or use a component like lucene : https://lucenenet.apache.org/[^]
or my article hOOt : hOOt - full text search engine[^]
请阅读Sergey对该问题的评论,并按照以下说明链接:
如何:使用字符串方法搜索字符串(C#编程指南) [ ^ ]
如何:使用正则表达式搜索字符串(C#编程指南) [< a href =http://msdn.microsoft.com/en-us/library/ms228595.aspxtarget =_ blanktitle =新窗口> ^ ]
Please, read Sergey's comment to the question and follow below links:
How to: Search Strings Using String Methods (C# Programming Guide)[^]
How to: Search Strings Using Regular Expressions (C# Programming Guide)[^]
这篇关于搜索大型字符串列表的最快方法(使用通配符功能)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!