lucene全文检索结合用户行为优化排序结果

fancy1986 2013-10-11 10:01:03
问题是这样的:我在做一个全文检索引擎,对数据库表建索引进行查询,然后对查询结果进行排序;查询用到这三个字段:name(名称),address(地址),visits(查询频率);其中查询频率visit是动态变化的;
举例说明一下:我输入“测绘”,查询结果如下图,假设我想得到的结果是“省测绘局”,我点击省测绘局,会增加数据库中visit的值,我想通过visit的值来对查询结果进行排序。查询关键词和name匹配度的值为x,和address匹配度为:y,还有visit值为z,怎么建立一个数学模型:f(x,y,z)=f(x) + f(y) + f(z)?最后我根据f(x,y,z)对结果排序?x、y的值我是根据一个现成的一个开源的全文检索引擎lucene的匹配算法得到的在0~1之间,z值就是访问次数动态的在变化>0的整形。

...全文
262 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
xietingyan 2013-10-11
  • 打赏
  • 举报
回复
我们平常使用不用去管那个tfidf的公式。 Lucene allows influencing search results by "boosting" in more than one level: Document level boosting - while indexing - by calling document.setBoost() before a document is added to the index. Document's Field level boosting - while indexing - by calling field.setBoost() before adding a field to the document (and before adding the document to the index). Query level boosting - during search, by setting a boost on a query clause, calling Query.setBoost(). 刚看了一下https://lucene.apache.org/core/3_6_2/scoring.html,说可能有三个层次的boost,前两个boost在索引的时候就boost了, 如果简单在query的时候boost,看看org.apache.lucene.search下面的各种query用法就可以
fancy1986 2013-10-11
  • 打赏
  • 举报
回复
引用 1 楼 xietingyan 的回复:
好像在复杂query的时候可以设置各个query的boost值
我对visit的值设置boost,设置的原则是什么呢 不需要为 x、y、z建立数学模型吗?像lucene自己的评分体系那样
xietingyan 2013-10-11
  • 打赏
  • 举报
回复
好像在复杂query的时候可以设置各个query的boost值
fancy1986 2013-10-11
  • 打赏
  • 举报
回复
引用 5 楼 xietingyan 的回复:
[quote=引用 4 楼 fancy1986 的回复:] [quote=引用 3 楼 xietingyan 的回复:] 我们平常使用不用去管那个tfidf的公式。 Lucene allows influencing search results by "boosting" in more than one level: Document level boosting - while indexing - by calling document.setBoost() before a document is added to the index. Document's Field level boosting - while indexing - by calling field.setBoost() before adding a field to the document (and before adding the document to the index). Query level boosting - during search, by setting a boost on a query clause, calling Query.setBoost(). 刚看了一下https://lucene.apache.org/core/3_6_2/scoring.html,说可能有三个层次的boost,前两个boost在索引的时候就boost了, 如果简单在query的时候boost,看看org.apache.lucene.search下面的各种query用法就可以
你没明白我的意思 我是希望加入用户查询行为分析,来对结果进行重新排序,不是在lucene基础之上进行排序[/quote] 我理解的查询排序只能在一个过程中处理,比如要么用sql排序,要么用lucene排序,所以就是一个三个字段的查询排序呀~难道还有别的意思...[/quote]呃,我直接对field setBoost,我怎么知道我赋值多少合适呢,我想我是不是要用什么数学模型对name-score、address-score和visit值三个影响因子分配权重呢?
xietingyan 2013-10-11
  • 打赏
  • 举报
回复
引用 4 楼 fancy1986 的回复:
[quote=引用 3 楼 xietingyan 的回复:] 我们平常使用不用去管那个tfidf的公式。 Lucene allows influencing search results by "boosting" in more than one level: Document level boosting - while indexing - by calling document.setBoost() before a document is added to the index. Document's Field level boosting - while indexing - by calling field.setBoost() before adding a field to the document (and before adding the document to the index). Query level boosting - during search, by setting a boost on a query clause, calling Query.setBoost(). 刚看了一下https://lucene.apache.org/core/3_6_2/scoring.html,说可能有三个层次的boost,前两个boost在索引的时候就boost了, 如果简单在query的时候boost,看看org.apache.lucene.search下面的各种query用法就可以
你没明白我的意思 我是希望加入用户查询行为分析,来对结果进行重新排序,不是在lucene基础之上进行排序[/quote] 我理解的查询排序只能在一个过程中处理,比如要么用sql排序,要么用lucene排序,所以就是一个三个字段的查询排序呀~难道还有别的意思...
fancy1986 2013-10-11
  • 打赏
  • 举报
回复
引用 3 楼 xietingyan 的回复:
我们平常使用不用去管那个tfidf的公式。 Lucene allows influencing search results by "boosting" in more than one level: Document level boosting - while indexing - by calling document.setBoost() before a document is added to the index. Document's Field level boosting - while indexing - by calling field.setBoost() before adding a field to the document (and before adding the document to the index). Query level boosting - during search, by setting a boost on a query clause, calling Query.setBoost(). 刚看了一下https://lucene.apache.org/core/3_6_2/scoring.html,说可能有三个层次的boost,前两个boost在索引的时候就boost了, 如果简单在query的时候boost,看看org.apache.lucene.search下面的各种query用法就可以
你没明白我的意思 我是希望加入用户查询行为分析,来对结果进行重新排序,不是在lucene基础之上进行排序

50,530

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧