指数分析而非分析? [英] Index Analyzed and not Analyzed?

查看:126
本文介绍了指数分析而非分析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Lucene.net在我的应用程序中进行索引和搜索,我想向用户提供NORMAL和正则表达式搜索,但对于正常搜索,我需要以分析方式索引我的文档,并且我需要做正则表达式它通过Not Analyzed方式,并且我不能将同一文档两次索引以支持两种搜索类型...帮助我Pravin thokal

I am using Lucene.net for indexing and searching in my application, I would like to offer NORMAL And Regular Expression Search to user but for normal search I need to index my document In Analyzed way and for regular expression I need to do it by Not Analyzed way, And I cant index same document twice to support both search type...help me Pravin thokal

推荐答案

我强烈建议您将文档索引两次:首先作为分析字段,然后作为非分析字段。 Lucene的冗余并不是件坏事。 Lucene使用反向索引,因此当索引增长时,通常只能通过指针通常较低成本储存。 (我在这里过于简单化了。还有其他因素要考虑,比如有多少独特的术语以及你正在进行什么样的分析。)

I highly recommend you index the document twice: first as an analyzed field and second as a non-analyzed field. Redundancy is not a bad thing with Lucene. Lucene uses an inverted index, so when the index grows it is usually only by pointers which are typically low cost storage-wise. (I am oversimplifying here. There are other factors to consider, like how many unique terms there are and what kind of analysis you're performing.)

仅为文本编制索引曾经会导致搜索速度慢得多。为什么?您必须存储未分析的文本,这意味着您的正常搜索必须在搜索时执行分析。 (为什么存储未分析的文本?如果存储分析的文本,您将无法对其进行正则表达式搜索的分析。)

Indexing the text only once will lead to much slower search performance. Why? You'll have to store the non-analyzed text, which means your "normal searches" will have to perform analysis at search-time. (Why store the non-analyzed text? If you store the analyzed text, you won't be able to un-analyze it for your regular expression searches.)

取决于在您的场景中,您可能有一个适合探索的中间地带。例如,也许您的正则表达式搜索可以容忍一些分析(例如不区分大小写),也许您的正常搜索不需要那么多分析(例如保留噪音词)。

Depending on your scenario there may be a middle ground for you to explore. For example, perhaps your regular expression searches can tolerate a little bit of analysis (such as case insensitivity), and perhaps your normal searches don't require that much analysis (such as preservation of noise words).

这篇关于指数分析而非分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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