Solr.NET快速入门(八)【覆盖默认映射器,NHibernate集成】

SolrNet Source 立即下载

覆盖默认映射器

默认情况下,SolrNet使用属性映射Solr字段。 但是,您可能需要使用另一个映射程序。 替换默认映射器取决于您如何设置库:
内置容器

如果使用默认的内置容器,可以在调用Startup.Init()之前替换它:

var mapper = new MappingManager();
//这里是你的映射
var container = new Container(Startup.Container);
container.RemoveAll<IReadOnlyMappingManager>();
container.Register<IReadOnlyMappingManager>(c => mapper);
ServiceLocator.SetLocatorProvider(() => container);
Startup.Init<Document>("http://localhost:8983/solr");

Windsor设施

如果您使用Windsor设施,您可以覆盖映射器,如下所示:

var mapper = new MappingManager();
/* Here come your mappings */
var solrFacility = new SolrNetFacility("http://localhost:8983/solr") {Mapper = mapper};
var container = new WindsorContainer();
container.AddFacility("solr", solrFacility);

Ninject模块

var mapper = new MappingManager();
/*这里是你的映射* /
var c = new StandardKernel();
c.Load(new SolrNetModule("http://localhost:8983/solr") {Mapper = mapper});

NHibernate-SolrNet集成

SolrNet中包含了NHibernate-SolrNet模块,具有以下功能:

 自动数据库 - > Solr同步
 从NHibernate的ISession发出Solr查询

这旨在用于在NHibernate和SolrNet上类似映射的实体。

此集成已弃用。 它不是通用的,不能真正可重用于大多数非平凡的情况。 它将在未来的SolrNet版本中删除。

建立

照常配置SolrNet和NHibernate。 然后应用SolrNet的集成到NHibernate的配置像这样:

NHibernate.Cfg.Configuration cfg = SetupNHibernate();
var cfgHelper = new NHibernate.SolrNet.CfgHelper();
cfgHelper.Configure(cfg, true); // true - >在每次操作后自动提交Solr(不推荐)

如果您不使用默认的内置容器,您必须告诉CfgHelper使用它,例如:

IWindsorContainer container = new WindsorContainer();
...
var cfgHelper = new NHibernate.SolrNet.CfgHelper(container);
...

用法

每当创建,更新或删除也在SolrNet中映射的NHibernate实体时,它将在Solr上自动更新。 NHibernate事务被授予:只有当NHibernate事务被提交时,实体才在Solr上被更新。

这种同步仅在NHibernate - > SolrNet的方向上进行,而不是相反,即直接通过ISolrOperations发出的操作不会反映在NHibernate上。

为了通过NHibernate发出Solr查询,ISession需要包装。 示例:

ISessionFactory sessionFactory = ...
using (var session = cfgHelper.OpenSession(sessionFactory)) {
   ICollection<Entity> entities = session.CreateSolrQuery("this is a full-text query").SetMaxResults(10).List<Entity>();
}
基于MediaPipe的智能俯卧撑计数与姿势矫正系统 在现代健身和体能训练中,俯卧撑是最基础也是最有效的自重训练动作之一。然而,许多人在进行俯卧撑训练时常常存在姿势不正确、计数不准确等问题。本文将介绍如何利用计算机视觉和姿态估计技术,开发一个智能的俯卧撑计数与姿势矫正系统。 阅读详情

相关推荐

数据分析—用户行为数据分析

一般价值用户(R高F高M低):用户处于购买活跃期,感兴趣的商品多,购买次数少 → 针对该部分客户,目的就是要让他们购买,所以可以和运营部门沟通,降低利润,给出有力折扣促进购买,进而转为重要价值用户。重要价值用户(R高F高M高)维护:用户处于购买活跃期,感兴趣的商品多,购买次数也多 → 针对兴趣产品,保持一定频率的触达,持续维护。

m0_74091312的博客 1418

solr的原子更新/局部更新

solr的原子更新/局部更新

u012632105的博客 290

WSL2迁移后用户名不见了?一招教你快速恢复Ubuntu22.04默认用户

本文针对WSL2迁移后Ubuntu 22.04默认用户名丢失的常见问题,提供了详细的诊断与修复方案。通过分析迁移底层逻辑,指导用户使用`ubuntu2204.exe config --default-user`命令或配置`/etc/wsl.conf`文件快速恢复用户身份,并涵盖权限修复、冲突解决及自动化迁移脚本等进阶内容,确保子系统迁移后环境完整可用。

web39explorer的博客 555

不拼手速拼工具:biliTickerBuy 三阶段上手,把 B站会员购抢票自动化

你是不是也经历过这种时刻?开票前一秒死死盯着屏幕,倒计时一结束立刻狂点鼠标,结果页面转了两圈,票已经没了。手速再快也没用,你的电脑时间、网络延迟都在暗中拖后腿。而 biliTickerBuy 这款开源免费的 B站会员购抢票辅助工具,思路完全不同——它用自动化把「拼手速」变成「拼配置」,你要做的只是把参数填对,剩下的交给程序。抢票的胜负,从来不在手,而在准。 这篇文章不整虚的,直接按「新手 → 进

gitblog_00713的博客 90

单片机控制双向可控硅的5种实用触发电路设计(附完整电路图)

本文深入解析了单片机控制双向可控硅的5种实用触发电路设计,涵盖从基础隔离到复杂负载驱动的实战方案。重点探讨了光电耦合器选型、过零检测同步、RC吸收电路精密计算以及应对感性负载和高噪声环境的加固策略,并提供了完整的电路图与调试避坑指南,旨在帮助开发者实现安全可靠的交流负载控制。

joy55的博客 2194

天线学习笔记——HFSS简单阵列天线

在HFSS15.0版本中使用 Radiation --> Antenna Array Setup 设置天线阵列的参数时的设计列表如下: 值得注意的是,在该版本中所定义的是:第一个阵元的位置坐标(First Cell Position)、阵元之间的间距(Directions)和阵元的数量(Number of Cells) 这些参数。 在ANSYS中的HFSS仿真中定义天线阵列如下: 与老版本不同的是:中心点坐标(Center Position)和布局设置(Layout Setting)。在布局设置中

Ethan的博客 1万+

solr原子更新-即指定更新某个字段的值

官方文档:https://wiki.apache.org/solr/Atomic_Updates SolrInputDocument solrInputDocument = new SolrInputDocument(); solrInputDocument.addField("id", id); MapString, String > operation = new HashMap

Mergades 1万+

C# 实现鼠标轨迹录制与回放自动化功能(附源码)

通过本文的介绍,相信大家已经掌握了鼠标轨迹录制与回放功能的实现方式。该功能在自动化测试和重复性工作中具有重要应用价值。后续可以进一步优化,增加更多扩展功能,形成一个完整的自动化工具。

weixin_72139050的博客 1755

强烈推荐:SolrNet —— 桥接.NET世界与Apache Solr的完美工具

如果你正在寻找一种方式将你的.NET应用无缝链接至强大的全文搜索引擎Apache Solr,那么恭喜你找到这篇文章。今天我非常荣幸地向大家介绍一个超凡脱俗的开源项目——**SolrNet**。 ## 项目介绍 SolrNet是一个专为.NET开发人员打造的Apache Solr和SolrCloud客户端库。不同于其他试图抽象Solr功能的框架,SolrNet更倾向于假设你已熟悉Solr的核心操...

gitblog_00150的博客 615

华为OD机试双机位C卷-简单的解压缩算法(C/C++/Py/Java/Js/Go)

华为OD机试(机考)双机位C卷 【简单的解压缩算法】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD真题【简单的解压缩算法】。

qq_45776114的博客 474

Raspberry Pi 4 ARM Trusted Firmware 技术解析

摘要: 本文详细介绍了在树莓派4(Raspberry Pi 4)上移植ARM可信固件(TF-A)的实现方案与安全考量。该移植专注于BL31功能,作为非安全世界(如Linux内核)的启动桥梁,支持加载EL2级别程序。文章分析了启动流程、内存映射设计,并对比了RPi3与RPi4的关键差异,指出当前版本缺乏硬件级安全内存保护的局限性。此外,提供了构建指南、配置说明及设备树自动修补的实现细节,强调通过config.txt简单配置即可启动64位内核。该方案充分利用树莓派原有GPU固件流程,兼顾兼容性与简易性。

Linux内核架构师 932

推荐 SolrNet:一款强大的 .NET 库,用于操作 Apache Solr

如果你正在寻找一个可以轻松地管理和搜索数据的工具,那么 SolrNet 可能是你的最佳选择。SolrNet 是一个开源的 .NET 库,可以帮助你通过简单的 API 调用来与 Apache Solr 进行交互。 ## 什么是 SolrNet? SolrNet 是一个 .NET 库,用于与 Apache Solr 进行通信。它提供了简单易用的接口,可以帮助你创建、更新、查询索引,并且支持多种数据类...

gitblog_00007的博客 551

18、知识表示与学习范式

本文探讨了智能系统中的核心组成部分——知识表示与学习范式。从基础知识到实际应用,详细解析了符号表示、框架表示、语义网络和本体表示等知识表示方法,并介绍了监督学习、无监督学习、半监督学习和强化学习等学习范式。此外,还深入分析了这些技术在自然语言处理、图像识别和推荐系统等领域的具体应用及操作步骤。最后,展望了未来可能的技术发展方向。

ttt77的博客 84

Solr.NET快速入门(七)【覆盖默认映射器,NHibernate集成】

覆盖默认映射器 默认情况下,SolrNet使用属性映射Solr字段。 但是,您可能需要使用另一个映射程序。 替换默认映射器取决于您如何设置库: 内置容器 如果使用默认的内置容器,可以在调用Startup.Init()之前替换它: var mapper = new MappingManager(); //这里是你的映射 var container = new Container(Start...

a879086的博客 142

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

Solr.NET快速入门(一)【基本使用,映射字段】

字典映射和动态字段Solr dynamicFields可以根据用例不同地映射。 它们可以被“静态地”映射,例如,给定:<dynamicField name="price_*" type="integer" indexed="true" stored="true"/>一个特定的dynamicField实例可以映射为:[SolrField("price_i")] public decimal? P

极客神殿 2953

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

【转帖】Solr.Net的使用

https://github.com/mausch/SolrNet/blob/master/Documentation/Basic-usage.md Basic usage First, we have to map the Solr document to a class. Let's use a subset of the default schema that...

aidou6545的博客 295

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

solr .Net端(SolrNet)

首先 引用SolrNet.dll Microsoft.Practices.ServiceLocation HttpWebAdapters 也可以用.net IDe 中的 nuget下载 solrnet包 //清除上次请求(不清除会导致重复请求报错) SolrNet.Startup.Container.Clear(); SolrNet.Startu...

weixin_33739646的博客 341

mini api

大部分主流语言都支持web框架,并且实现起来相对轻便,简捷,比如:go的gin包packagemain import"github.com/gin-gonic/gin"...

dotNET跨平台 742

3步彻底解决Upscayl GPU加速问题:从故障到流畅运行

Upscayl是一款免费开源的AI图像放大工具,利用先进的AI技术将低分辨率图片转换为高清图像。它依赖GPU加速来提供快速的处理速度,但不少用户在启动时遇到了"GPU错误"或"Vulkan初始化失败"的问题。别担心,这篇文章将手把手帮你解决这些问题,让你的Upscayl重新飞起来! ## 问题引入:你可能会遇到的两种典型场景 **场景一:初次使用就卡壳** 🚫 你刚下载了Upscayl,兴奋

gitblog_00077的博客 400

Solr.NET快速入门(八)【多核多实例,映射验证】

多核/多实例 本页介绍如何配置SolrNet访问(读/写)多个Solr内核或实例。 它假定您知道Solr内核是什么,如何在SolrNet外部配置和使用它们。 此页面不涵盖CoreAdminHandler命令。 如何配置SolrNet for multicore取决于它如何集成到您的应用程序,如果您的内核映射到不同类型或相同类型。 内置容器 内置容器(启动)当前仅限于访问具有不同映射类型的...

a879086的博客 271

Solr学习总结(五)SolrNet的基本用法及CURD

上一篇已经讲到了Solr 查询的相关的参数。这里在讲讲C#是如何通过客户端请求和接受solr服务器的数据, 这里推荐使用SolrNet,主要是:SolrNet使用非常方便,而且用户众多,一直都在更新,感兴趣的可以加入他们的邮件群组,方便迅速了解 SolrNet的最新动态。   SorlNet源码地址:https://github.com/mau...

weixin_34413802的博客 191

SolrNET 属性的三种映射

第一种:    public class Blog {     [SolrUniqueKey("id")]     public string 唯一标志{ get; set; }     [SolrField("Content")]     public string 全文 { get; set; } } 第二种: public class Blog {     public s...

UserNameyyy的博客 364

Solr.NET快速入门(二)【查询】

简单查询这是SolrNet中最简单的“查询对象”。 无论你给它什么都直接传递给Solr的q参数ISolrOperations<Product> solr = ... var products1 = solr.Query(new SolrQuery("lucene")); // search for "lucene" in the default field var products2 = solr.

极客神殿 4631

.net+solr的使用从删库到跑路

引用SolrNet.dll,Microsoft.Practices.ServiceLocation.dll,HttpWebAdapters.dll 新建class [SolrUniqueKey("id")] public string id { get; set; } [SolrField("a100")] public string a100...

qq_30225481的博客 378

词组查询以及多值映射等SolrNet使用中的细节问题

转自:http://www.duxuan.cn/doc/6896594.html 转载于:https://www.cnblogs.com/gavin-num1/p/6068224.html

weixin_30332705的博客 130

在业务逻辑层中使用Castle Facility:Automatic Transaction Management

我的网站的架构采用Castle+Ibatis+Asp.net,业务逻辑层的事务处理采用Castle Facility:Automatic Transaction Management ,这是AOP事务方面的一个应用吧,下面介绍一下如何在业务逻辑层中使用这个Facility.这个Faciity作用就是管理事务,依赖于是否抛出异常的结果进行Commit还是rollback.网站架构中同时用到了iBat

shanyou的专栏 3581
上一篇: Solr.NET快速入门(七)【核心管理,Fluent API】
下一篇: Solr.NET快速入门(九)【多核多实例,映射验证】
.NET跨平台
博客等级 码龄15年 6066粉丝 738原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值