此问题先前已在堆栈溢出中突出显示,但是应用他们的建议似乎无法解决我的问题。
我想使用“ Adele”作为输入来返回名称字段的建议。
我使用以下URL:public class RController : ControllerBase
{
public IActionResult R()
{
var cb = _cache.Get("IDGKey");
return Ok(cb);
}
}
哪个返回以下结果:
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', indexRouter); //routes to index.js -> index.ejs
app.use('/users', usersRouter);
app.get('/', function(req, res){
res.set('Pressed Button')
});
// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
res.status(err.status || 500);
res.render('error');
});
但是,常规搜索http://localhost:8983/solr/test8/suggest?suggest.build=true&suggest=true&suggest.q=name:adele
返回正确的结果。
我在 managed-schema
中具有存储为true的名称字段 {
"responseHeader":{
"status":0,
"QTime":10},
"command":"build",
"suggest":{"mySuggester":{
"name:adele":{
"numFound":0,
"suggestions":[]}}}}
在solrconfig.xml中,我将请求处理程序定义为:
http://localhost:8983/solr/test8/select?q=name%3Aadele
到“建议者”搜索组件的链接为:
<field name="name" type="text_general" stored="true"/>
我尝试使用<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="suggest.dictionary">mySuggester</str>
<str name="suggest">true</str>
<str name="suggest.count">10</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
重新启动,并且我的请求处理程序和搜索组件与Apache Solr Docs上的结果相对应,并且取自其他在线资源,但未返回任何结果。