You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/cls/iKnowDoc/Search/Domain.cls
+37-2Lines changed: 37 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,8 @@ Class iKnowDoc.Search.Domain Extends %Persistent
4
4
{
5
5
6
6
/// Similar entity search method. Returns JSON-object containing 10 entities similar to input string.
7
-
ClassMethodGetSimilar(SearchString) As%Status
7
+
// Old version
8
+
/*ClassMethod GetSimilar(SearchString) As %Status
8
9
{
9
10
try {
10
11
if ($length(SearchString)>1) {
@@ -19,7 +20,7 @@ ClassMethod GetSimilar(SearchString) As %Status
19
20
set Result(12) = $lb(999999," ",0,0)
20
21
for i=1:1:10 {
21
22
set оrd = $order(Result(i),1,Data)
22
-
if$li(Result(i),4)>2 {
23
+
if $li(Result(i),2)>2 {
23
24
if ($FIND($li(Data,2),"--")'=0) {
24
25
set string =" "
25
26
} elseif ($FIND($li(Data,2),"|")'=0) {
@@ -46,6 +47,40 @@ ClassMethod GetSimilar(SearchString) As %Status
46
47
write ResultJSON.%ToJSON()
47
48
}
48
49
quit $$$OK
50
+
}*/
51
+
52
+
ClassMethodGetSimilar(SearchString) As%Status
53
+
{
54
+
try {
55
+
if ($length(SearchString)>1) {
56
+
// Forming a dynamic object
57
+
setResultJSON = { "entities": [] }
58
+
// Getting data from Result array and pushing to the dynamic object
59
+
//set myquery = "SELECT TOP 10 e.Word as Word, s.Spread FROM %iFind.FindWords('"_SearchString_"*') e JOIN User_DocBook.DocBook_contentInd_WordSpread s ON e.WordId= s.WordId ORDER BY Spread DESC"
60
+
setmyquery = "SELECT TOP 10 e.Entity as Word, s.Spread FROM %iFind.FindEntities('"_SearchString_"*') e JOIN User_DocBook.DocBook_contentInd_EntSpread s ON e.EntityId = s.EntityId where s.Spread > 2 ORDER BY Spread DESC"
0 commit comments