KBPortalServiceImpl - 전역
KBPortalServiceImpl API는 지식 관리 V3 [com.snc.knowledge3]에 스크립트 포함으로 포함되어 있습니다. 사용자 지정 검색과의 통합과 같이 지식에 사용할 수 있는 방법을 제공합니다.
KBPortalServiceImpl - KBPortalServiceImpl()
전역 애플리케이션에서 KBPortalServiceImpl 개체를 인스턴스화합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 없음 |
KBPortalServiceImpl - getResultData(객체 요청)
지식 문서의 키워드와 사용자가 읽을 수 있는 관련 지식 블록 컨텐츠를 기반으로 검색 결과를 반환합니다.
지식 블록 기능을 활성화하고 애플리케이션에서 지식에 대한 사용자 지정 검색을 사용하는 경우, 블록에 키워드가 포함되어 있으면 관련 문서가 반환되지 않을 수 있습니다. 아티클의 키워드 및 사용자가 읽을 수 있는 관련 블록 콘텐츠를 기반으로 검색 결과를 반환하려면 사용자 지정 검색 내에서 getResultData() 메서드를 호출해야 합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 요청 | 객체 | 검색을 구체화할 JSON 객체입니다. |
| 유형 | 설명 |
|---|---|
| 객체 | 지식 문서 및 사용자가 읽을 수 있는 관련 지식 블록 컨텐츠의 키워드를 기반으로 하는 JSON 형식의 검색 결과 배열입니다. |
사용자 지정 검색과 지식 블록 통합
function doKeywordSearch(queryText, count, queryLocation) {
var results = [];
// To set up the request.
var request = {
keyword: queryText,
language: "",
// To pass data to filter on different metadata.
variables: {
kb_knowledge_base: ['Knowledge'],
kb_category: '',
author: ['']
},
// Provide the following.
context: gs.getProperty('glide.knowman.sp.search_context', 'Knowledge Search'),
resource: 'Knowledge',
order: "relevancy,true",
// Provide the pagination variables.
start: queryLocation,
end: queryLocation+count,
attachment: false,
// Provide any additional metadata you want to include in your results.
knowledge_fields: [
"number",
"sys_id",
"published"
]
};
// To execute the search.
var response = new KBPortalServiceImpl();
response.getResultData(request);
// To send the search results back to the UI or to store results in your object.
for (var i = 0; i < response.results.length; i++) {
result = response.results[i];
var article = {};
article.sys_id = result.meta.sys_id.display_value;
article.number = result.meta.number.display_value;
article.short_description = article.short_description;
article.title = result.title;
article.published = result.meta.published.display_value;
article.publishedUTC = result.meta.published.display_value;
article.text = article.text;
article.score = result.meta.score;
article.label = article.short_description;
article.shortDescription = article.short_description;
results.push(article);
}
return results;
}