我如何实施标签搜索?使用Lucene? [英] How do i implement tag searching? with lucene?

查看:352
本文介绍了我如何实施标签搜索?使用Lucene?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还没有使用Lucene的。我最后一次问(多月前,也许一年)人建议Lucene的。如果我不应该使用Lucene的,我应该用什么呢?由于上午的例子说,有标签这样的项目

I havent used lucene. Last time i ask (many months ago, maybe a year) people suggested lucene. If i shouldnt use lucene what should i use? As am example say there are items tagged like this

  1. 苹果胡萝卜
  2. 苹果
  3. 胡萝卜
  4. 苹果香蕉

如果用户搜索的苹果我不关心,如果有来自1,2和4。任何preference但是我看到很多论坛做到这一点,我恨是当用户搜索苹果胡萝卜2和3具有较高的结果,而1是很难找到,即使它更接近我的搜索。

if a user search apples i dont care if there is any preference from 1,2 and 4. However i seen many forums do this which i HATED is when a user search apple carrots 2 and 3 have high results while 1 is hard to find even though it matches my search more closely.

此外,我想这样做搜索胡萝卜-apples这只会让我3。我不知道如果我搜索胡萝卜香蕉,但不管怎么说,只要更多的项目有2个和3个搜寻结果较低的排名应该发生什么的能力那么1当我搜索苹果胡萝卜我会很高兴。

Also i would like the ability to do search carrots -apples which will only get me 3. I am not sure what should happen if i search carrots banana but anyways as long as more items tagged with 2 and 3 results are lower ranking then 1 when i search apples carrots i'll be happy.

Lucene的能做到这一点?而我从哪里开始?我试图寻找它,只有这样,我看到了很多的类和我会看到的教程讲的文档,网页,但没有人清楚该怎么做时,我喜欢标记的东西。如果不是Lucene的,我应该用什么标签?

Can lucene do this? and where do i start? I tried looking it up and when i do i see a lot of classes and i'll see tutorials talking about documents, webpages but none were clear about what to do when i like to tag something. If not lucene what should i use for tagging?

推荐答案

Lucene的用于.NET似乎是成熟的。无需使用Java或SOLR

Lucene for .net seems to be mature. No need to use Java or SOLR

借助标准查询语言Lucene的允许同样排在搜索词和否定

The Standard query language for Lucene allows equally ranked search terms and negation

所以,如果你的Lucene索引过场标记您的查询是

So if your Lucene index had a field "tag" your query would be

tag:apple* OR tag: carrot*

这将给予同等的排名为每个单词,多级加权既标记文件

Which would give equal ranking to each word, and more rank weighting to document with both tags

要否定一个标签使用本

tag:carrot* NOT tag:apple*

简单的例子来说明索引和使用Lucene 这里查询

这篇关于我如何实施标签搜索?使用Lucene?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆