How do I create RavenDb static indexes for this document given these requirements?

I have about 3 million documents stored in an embedded RavenDb instance. Each of the fields will be subjected to some type of filtering / query / sorting, but in particular, I would like to do some type of smart text search on the info and info2 columns. How can I build RavenDb indexes?

My first pass on 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 } }
});

      

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

}

      

+3


source to share


1 answer


Spaten,

Create a single RavenDB index that lists all the properties that interest you. Mark Info2 and Info as full text search (parsed).



You are pretty much done.

+3


source







All Articles