考虑到这些要求,我如何为此文档构建我的 RavenDb 静态索引? [英] How do I construct my RavenDb static indexes for this document, given these requirements?

查看:47
本文介绍了考虑到这些要求,我如何为此文档构建我的 RavenDb 静态索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有将近 300 万个文档存储在 RavenDb 嵌入式实例中.每个字段都会受到某种类型的过滤器/查询/排序的影响,但特别是我想对 info 和 info2 列进行某种类型的智能文本搜索.我该如何构建 RavenDb 索引?

I have close to 3 million documents that are being stored in a RavenDb embedded instance. Everyone of the fields will be subjected to some type of filter/query/sorting, but in particular I wanted to do some type of intelligent textual search of the info and info2 columns. How might I go about constructing the RavenDb Indexes?

我第一次通过 info2 列看起来像这样.

My first pass at the info2 column looks like this.

store.DatabaseCommands.PutIndex("ProdcustByInfo2", new IndexDefinitionBuilder<Product>
{
    Map = products => from product in products
                      select new { product.INFO2 },
    Indexes = { { x => x.INFO2, FieldIndexing.Analyzed } }
});

谢谢,斯蒂芬

[Serializable]
public class Product
{
    public string AveWeight { get; set; }

    public string BrandName { get; set; }

    public string CasePack { get; set; }

    public string Catalog { get; set; }

    public decimal CatalogId { get; set; }

    public decimal CategoryId { get; set; }

    public string Info { get; set; }

    public bool IsOfflineSupplierItem { get; set; }

    public bool IsRebateItem { get; set; }

    public bool IsSpecialOrderItem { get; set; }

    public bool IsSpecialPriceItem { get; set; }

    public bool IsTieredPricingItem { get; set; }

    public string ItemNum { get; set; }

    public string ManufactureName { get; set; }

    public string ManufactureNum { get; set; }

    public decimal OffineSupplierId { get; set; }

    public string PackageRemarks { get; set; }

    public decimal Price { get; set; }

    public decimal PriceGroupId { get; set; }

    public decimal ProductId { get; set; }

    public string ProductName { get; set; }

    public int Quantity { get; set; }

    public string SupplierName { get; set; }

    public string UOM { get; set; }

    public string Upc { get; set; }

    public string Url { get; set; }

}

推荐答案

Spaten,

创建单个 RavenDB 索引,该索引输出您有兴趣查询的所有属性.将 Info2 和 Info 标记为全文搜索(已分析).

Create a single RavenDB index, which output all of the properties that you are interested in querying on. Mark the Info2 and Info as full text search (Analyzed).

大功告成.

这篇关于考虑到这些要求,我如何为此文档构建我的 RavenDb 静态索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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