我使用Lucene库开发了一个索引和搜索应用。但是在我的场景中,该库在自定义排名方面存在一些限制。除了性能之外,我需要可扩展性和访问各种词频等所有数据。是否有其他强大的开源全文库可供使用?
我使用Lucene库开发了一个索引和搜索应用。但是在我的场景中,该库在自定义排名方面存在一些限制。除了性能之外,我需要可扩展性和访问各种词频等所有数据。是否有其他强大的开源全文库可供使用?
http://www.sphinxconnector.net/
Sphinx的主要特点包括:
更详细地说,Sphinx:
var field = "*";
var query = "one | two";
var documentIndex = new MemoryDocumentIndex();
var content = "one two one two second try to welcome";
var title = "one first second four";
while (!documentIndex.IsReady)
{
Thread.Sleep(500);
}
var searchService = new SearchServiceEngine(documentIndex);
var doc = new IndexDocument("ExternalId");
doc.Add("content".GetField(content);
// filter
doc.Add("intValue".GetFilterField(10));
doc.Add("longValue".GetFilterField(20l));
doc.Add("dateValue".GetFilterField(DateTime.UtcNow));
searchService.Index(new IndexDocument[]
{
doc
});
var query = "one | two";
var parsed = query.Parse("*");
var request = new SearchQueryRequest()
{
Query = parsed,
Field = field,
ShowHighlight = true,
OrderField = SortOrderFields.Relevance,
Order = SortOrder.Desc,
Size = 20,
Fields = new List<string>()
{
"content","id"
},
Filter = new FilterClause()
{
Condition = FilterCondition.Equal,
Value = "intValue".GetFilterField(10),
Next = new FilterClause()
{
Condition = FilterCondition.Great,
Value = "longValue".GetFilterField(21l)
}
}
};
var result = searchService.Search(request);