争取每日记录一些

1.如果数字在文本中,比如"Be sure to include Form 1099 in your tax return".要搜索1099就要在创建索引使用不丢弃数字的分析器.

比如:WhitespaceAnalyzer或StandardAnalyzer

2.如果本身就是数字字段就可以使用NumericField进行索引,如果需要对这个字段进行排序,需要这个字段只能有唯一值.

//创建索引
doc.Add(new NumericField("if", Field.Store.YES, true).SetFloatValue(if));

//获取范围 
Query q = NumericRangeQuery.NewFloatRange("if", 1, 10, true, true);

//排序
mSearcher.Search(q, null, 100, new Sort(new SortField("if", SortField.FLOAT, true)));

 

索引日期

以前对日期时间类的数据都是格式化为字符串索引的,比如"yyyyMMdd"(20080808).

现在可以将其转换为数字类型的数据使用NumericField进行索引.这个值精确到多少可以自己来定.

LUCENE.NET QQ交流群(81361051) 

相关文章:

  • 2022-01-29
  • 2021-05-22
  • 2021-06-14
  • 2021-11-18
  • 2022-12-23
  • 2021-10-27
  • 2021-11-02
  • 2022-01-30
猜你喜欢
  • 2022-12-23
  • 2021-10-01
  • 2021-11-11
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2021-05-09
相关资源
相似解决方案