fix #2731 fix suggest api

This commit is contained in:
Shinsuke Sugaya 2023-03-30 14:45:24 +09:00
parent 4d2b938e85
commit 0a69c29545
6 changed files with 20 additions and 18 deletions

View file

@ -1,6 +1,6 @@
openapi: 3.0.3
info:
title: Fess - OpenAPI 3.0
title: Fess - User API
description: |-
This is a Fess Server based on the OpenAPI 3.0 specification.
license:
@ -8,7 +8,7 @@ info:
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 14.8.0
externalDocs:
description: API Documentation for Fess
description: API Documentation
url: https://fess.codelibs.org/14.8/api/
servers:
- url: http://localhost:8080/api/v1
@ -21,6 +21,8 @@ tags:
description: Monitoring operations
- name: suggest
description: Suggest operations
- name: favorite
description: Favorite operations
paths:
/documents:
get:
@ -597,14 +599,14 @@ paths:
schema:
type: object
properties:
took:
query_time:
type: integer
format: int64
example: 18
total:
record_count:
type: integer
example: 355
num:
page_size:
type: integer
example: 10
data:
@ -615,7 +617,7 @@ paths:
text:
type: string
example: fess
field:
labels:
type: array
items:
type: string

View file

@ -13,8 +13,8 @@ $(function() {
if (typeof $.fn.suggestor === "function") {
$("#as_q").suggestor({
ajaxinfo: {
url: contextPath + "/suggest",
fn: "_default,content,title",
url: contextPath + "/api/v1/suggest-words",
fn: ["_default", "content", "title"],
num: 10,
lang: $("#langSearchOption").val()
},

View file

@ -35,8 +35,8 @@ $(function() {
if (typeof $.fn.suggestor === "function") {
$("#query").suggestor({
ajaxinfo: {
url: contextPath + "/suggest",
fn: "_default,content,title",
url: contextPath + "/api/v1/suggest-words",
fn: ["_default", "content", "title"],
num: 10,
lang: $("#langSearchOption").val()
},

View file

@ -37,8 +37,8 @@ $(function() {
if (typeof $.fn.suggestor === "function") {
$("#contentQuery").suggestor({
ajaxinfo: {
url: contextPath + "/suggest",
fn: "_default,content,title",
url: contextPath + "/api/v1/suggest-words",
fn: ["_default", "content", "title"],
num: 10,
lang: $("#langSearchOption").val()
},

View file

@ -189,8 +189,8 @@ $(function() {
if (typeof $.fn.suggestor === "function") {
$("#query").suggestor({
ajaxinfo: {
url: contextPath + "/suggest",
fn: "_default,content,title",
url: contextPath + "/api/v1/suggest-words",
fn: ["_default", "content", "title"],
num: 10,
lang: $("#langSearchOption").val()
},

View file

@ -109,8 +109,8 @@
dataType: "json",
cache: false,
data: {
query: $textArea.val(),
fields: settingAjaxInfo.fn,
q: $textArea.val(),
field: settingAjaxInfo.fn,
num: settingAjaxInfo.num * 2,
lang: settingAjaxInfo.lang
},
@ -126,12 +126,12 @@
},
createAutoCompleteList: function(obj) {
if (obj.response.status !== 0) {
if (typeof obj.record_count === "undefined") {
$boxElement.css("display", "none");
return;
}
var hits = obj.response.result.hits,
var hits = obj.data,
suggestor = this,
reslist,
$olEle,