go-ego / riot

Go Open Source, Distributed, Simple and efficient Search Engine; Warning: This is V1 and beta version, because of big memory consume, and the V2 will be rewrite all code.
Apache License 2.0
6.11k stars 473 forks source link

How can I make my scoringFields persistent #32

Open sunface opened 6 years ago

sunface commented 6 years ago

Hi, in the scoringFields example, you just mentioned that scoringFields can be persistent,but how? We are now using riot as our first level chioce, so please help us

sunface commented 6 years ago

文档的 MyScoringFields 数据通过 riot.Engine 的 IndexDoc 函数传给排序器保存在内存中。然后通过 Search 函数的参数调用 MyScoringCriteria 进行查询。

当然,MyScoringCriteria的Score 函数也可以通过 docId 从硬盘或数据库读取更多文档数据用于打分,但速度要比从内存中直接读慢许多,请在内存和速度之间合适取舍。

suntong commented 3 years ago

+1