开发者

C# library for complex queries against in-memory strings

I am looking for something that will take a complex search string and allow me to test it against some text to determine whether the text meets the search criteria.

I would like to support query syntax similar to google/twitter (i.e. support for: and, or, not, exact string, wildcards, etc) and would also like it to handle plurals of words (maybe synonyms if I could have my cake and eat it). I guess what I want is the analysis and query aspects of a search engine without building and maintaining an index.

I really would like to avoid developing this, and thought that it seems lik开发者_StackOverflow中文版e it might be a fairly common requirement. But I have been unable to identify anything in the .net world that specifically meets my needs.

I thought I might be able to use elements of Lucene.net to do this, but have no experience with it. So I would like to know if anybody out there has any ideas that might help or if they have done this before (and what they used). Would be happy to consider non-.NET solutions if integration is possible.

Any input is much appreciated.

Regards Allen


Regex is exactly your solution.

The only thing you mentioned it doesn't support is synonyms and plurals obviously, because that is language depended. But I guess, you can easily get a list of synonyms, or exceptional plurals in English or something like that, and then write your Regex builder for those (really easy).

Regex is a shortcut for Regular Expressions, and is a well known engine, that exist in a lot of languages' libraries.

A nice site you can learn Regex from is http://www.regular-expressions.info/.

In dot net, all the Regex related classes are in System.Text.RegularExpressions. you can guess quite easily by yourself how to use it... (or just google C# REGEX or something)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜