正如在任何狮身人面像供电的应用程序,你有两个主要任务:
- 定义/创建您的狮身人面像索引(的sphinx.conf)
- 使用(.NET)连接器来提交您的查询
对于数检查狮身人面像文档,搜索的MySQL和sql_query。
至于,你应该是这样的:
public class MyController : Controller {
[HttpPost]
public ActionResult Search() {
string looking_for = Request.Form["search_item"];
SphinxClient sphinx_client = new SphinxClient();
List<Result> results = sphinx_client.Query(looking_for, "my_sphinx_index_name");
// your view should know what to do with a Result collection
return View(results);
}
}
PS:我使用这个.NET接口(其中我写= P)http://dotsphinxclient.codeplex.com/wikipage?title=Getting%20started&referringTitle=Documentation
非常容易理解的狮身人面像连接器中的代码。我检查了C#sphinx-dotnet-client的其他实现,以及其他一些可以在Google中找到的codeplex,你的看起来非常有趣。 – Zelid 2013-02-10 11:31:43
你如何连接到该客户端的索引? – Siyavash 2013-07-23 16:56:45