How do I construct my RavenDb static indexes for this document, given these requirements?

女生的网名这么多〃 提交于 2019-12-22 11:17:21

问题


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?

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 } }
});

Thank you, Stephen

[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; }

}

回答1:


Spaten,

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).

You are pretty much done.



来源:https://stackoverflow.com/questions/9961882/how-do-i-construct-my-ravendb-static-indexes-for-this-document-given-these-requ

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!