Forgot password?
 Create new account
Author: hbghlyj

algolia 搜索

[Copy link]

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-3-30 20:57:43
Last edited by hbghlyj at 2025-3-31 23:13:51Algolia有很多配置,每个选项 Algolia 网站上有解释,以下为当前Algolia配置您可以看看哪些需要调整: $type export-kuing-KZZUGXICHQ-1743434016.json (2.03 KB, Downloads: 1)

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-3-31 02:23:56
应该有一个选项可以只搜索标题而不搜索内容
不知道如何实现

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-3-31 02:57:49
建立搜索索引时,有的字符应作分隔符,和语言有关
如何把顿号、加入Algolia分隔符

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-3-31 22:57:28
见algolia文档Normalization for logogram-based languages (CJK)

Detecting words in CJK logograms, Algolia follows a two-step process:
  • Use the Unicode (ICU) library to find words. This library is based on the MECAB dictionary, enriched with data from Wiktionary.
  • If that fails, use a sequential character-based search.

如何手动添加中文单词

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-3-31 23:35:54
为何作者名都连在一起
以下是crawler配置,应该修改第26行,如何修改?
  1. new Crawler({
  2.   appId: "KZZUGXICHQ",
  3.   apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  4.   maxUrls: null,
  5.   indexPrefix: "",
  6.   rateLimit: 8,
  7.   renderJavaScript: false,
  8.   ignoreQueryParams: ["extra", "mobile"],
  9.   startUrls: [
  10.     "https://kuing.cjhb.site/forum.php?mod=forumdisplay&fid=5",
  11.     "https://kuing.cjhb.site/forum.php?mod=forumdisplay&fid=6",
  12.     "https://kuing.cjhb.site/forum.php?mod=forumdisplay&fid=14",
  13.   ],
  14.   discoveryPatterns: ["https://kuing.cjhb.site/**"],
  15.   schedule: "every 1 day at 12:51 pm",
  16.   maxDepth: 10,
  17.   actions: [
  18.     {
  19.       indexName: "kuing",
  20.       pathsToMatch: ["https://kuing.cjhb.site/thread*"],
  21.       recordExtractor: ({ url, $, contentLength, fileType }) => {
  22.         return [
  23.           {
  24.             objectID: url,
  25.             title: $("title").text().split(" - ").slice(0, -3).join(" - "),
  26.             author: $(".authi a").text(),
  27.             forum: $("title").text().split(" - ").slice(-3, -2)[0],
  28.             keywords: $('meta[name="keywords"]').prop("content"),
  29.             description: $('meta[name="description"]').prop("content"),
  30.             totalposts: $("div.message").length,
  31.             content: $("div.message")
  32.               .map(function () {
  33.                 $(this).find("i.pstatus").remove();
  34.                 return $(this).text();
  35.               })
  36.               .get()
  37.               .join("\n"),
  38.           },
  39.         ];
  40.       },
  41.     },
  42.   ],
  43.   sitemaps: ["https://kuing.cjhb.site/sitemap.xml"],
  44.   initialIndexSettings: {
  45.     kuing: {
  46.       advancedSyntax: true,
  47.       allowTyposOnNumericTokens: false,
  48.       attributeCriteriaComputedByMinProximity: true,
  49.       attributeForDistinct: "url",
  50.       attributesToRetrieve: ["*"],
  51.       attributesToSnippet: ["content:10"],
  52.       attributesForFaceting: ["forum"],
  53.       customRanking: [
  54.         "desc(weight.pageRank)",
  55.         "desc(weight.level)",
  56.         "asc(weight.position)",
  57.       ],
  58.       distinct: 1,
  59.       highlightPostTag: "</span>",
  60.       highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
  61.       ignorePlurals: true,
  62.       minProximity: 1,
  63.       minWordSizefor1Typo: 3,
  64.       minWordSizefor2Typos: 7,
  65.       ranking: [
  66.         "words",
  67.         "filters",
  68.         "typo",
  69.         "attribute",
  70.         "proximity",
  71.         "exact",
  72.         "custom",
  73.       ],
  74.       removeWordsIfNoResults: "allOptional",
  75.       searchableAttributes: [
  76.         "unordered(title)",
  77.         "author",
  78.         "unordered(keywords)",
  79.         "unordered(description)",
  80.         "unordered(content)",
  81.       ],
  82.     },
  83.   },
  84.   ignoreCanonicalTo: false,
  85.   safetyChecks: { beforeIndexPublishing: { maxLostRecordsPercentage: 10 } },
  86.   saveBackup: true,
  87. });
Copy the Code

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-3-31 23:40:39
Algolia提示:以下页面过大,无法索引
thread-8563-1-1.html
thread-8426-1-1.html
thread-12838-1-1.html
thread-11371-1-1.html

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-4-1 05:31:38
Last edited by hbghlyj at 2025-4-4 18:37:50
abababa 发表于 2025-3-30 03:12
搜索的结果有的还是不太准确,比如
“Lagrange乘数法”,结果有很多无关的。
“拉格朗日乘数法”,只有一个 ...
搜索结果不准确是否因为typo tolerance(容错)功能?
typo tolerance有4个选项:true, false, min, strict
默认为true
不知设为哪个比较好?
我现在把它改为了strict,您再试一下?

418

Threads

1627

Posts

110K

Credits

Credits
11886

Show all posts

abababa Posted at 2025-4-4 15:09:45
hbghlyj 发表于 2025-4-1 05:34
上面 Allow typo on numeric tokens 这个选项默认为 True 允许数字输错
需要修改为 False 吗? ...
觉得这个还是不准确。比如还是用“Lagrange乘数法”作为搜索词,结果可以看到,它把带有“法”字的那些都找了出来,这明显不是我想搜索的内容。要怎么才能让它准确呢?就是不搜索无关的东西。但是如果帖子的文本本身不包含“Lagrange乘数法”这几个字,但在解题时明显使用了Lagrange乘数法这个方法的,却应该包含进来。

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-4-4 18:21:11
Last edited by hbghlyj at 2025-4-4 18:39:03
abababa replied at 2025-4-4 08:09
觉得这个还是不准确。比如还是用“Lagrange乘数法”作为搜索词,结果可以看到,它把带有“法”字的那些都 ...

如我们直接进行检索,检索结果会将单词(一个字)分开

用"乘数法"作为搜索词,结果可以看到

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-4-4 18:26:44
Last edited by hbghlyj at 2025-4-4 18:38:59开启了Advanced query选项
如果关键词包含多个词,不想分开,可以使用引号""包覆词组进行检索。

418

Threads

1627

Posts

110K

Credits

Credits
11886

Show all posts

abababa Posted at 2025-4-4 21:03:42
hbghlyj 发表于 2025-4-4 18:21
如我们直接进行检索,检索结果会将单词(一个字)分开

用"乘数法"作为搜索词,结果可以看到
用加了引号的"乘数法"搜索,有好多都和这个词无关,比如第二页里就有很多无关的帖子。现在应该够全面了,但是应该让它更准确点。

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-4-4 21:45:21
abababa 发表于 2025-4-4 14:03
应该让它更准确点
不知如何修改Algolia索引选项。关闭容错功能吗

418

Threads

1627

Posts

110K

Credits

Credits
11886

Show all posts

abababa Posted at 2025-4-5 19:16:33
hbghlyj 发表于 2025-4-4 21:45
不知如何修改Algolia索引选项。关闭容错功能吗
我觉得还是测试好了再用吧,直接在论坛上测试不好。我也不懂这个Algolia有什么优点,我自己理想中的搜索功能就是:把涉及搜索词的相关帖子都找出来,不相关的不显示。所说的相关,就是指内容上的相关,就像我在38楼说的那样,尽管有的帖子里本身没有搜索词,但是解题方法却明显使用了搜索词,这种应该能找出来。目前论坛本身的搜索功能就是差这一点,其它方面我反而觉得论坛的全文搜索比这个Algolia要好用。

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

kuing Posted at 2025-4-5 19:46:18
abababa 发表于 2025-4-5 19:16
我觉得还是测试好了再用吧,直接在论坛上测试不好。我也不懂这个Algolia有什么优点,我自己理想中的搜索 ...
我多数也还是用论坛自带的搜索,除非是记忆很模糊的时候才用那个 Algolia,记不清时不断尝试相近的关键词,这时实时显示结果也比较方便,嗯,它的优点大概就是模糊搜索,但离 google 那样的还差很多。

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-4-5 21:00:37
abababa replied at 2025-4-5 12:16
我觉得还是测试好了再用吧 ...

我不知道如何进一步修改其配置(例如,搜索结果排名标准是可以修改的。目前我们使用的标准是: ["words","filters","typo","attribute","proximity","exact", "custom"],靠前的标准意味着优先。不知道目前的标准是否可以改进)
似乎只有在付费版本中才有推荐机制

418

Threads

1627

Posts

110K

Credits

Credits
11886

Show all posts

abababa Posted at 2025-4-5 21:00:17
kuing 发表于 2025-4-5 19:46
我多数也还是用论坛自带的搜索,除非是记忆很模糊的时候才用那个 Algolia,记不清时不断尝试相近的关键词 ...
我觉得是那些字母改变了就不好搜索,比如$x,y,z$改成$a,b,c$,$\triangle DEF$改成$\triangle A'B'C'$之类的,很不好搜索。

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-4-5 21:05:55
abababa replied at 2025-4-5 14:00
我觉得是那些字母改变了就不好搜索,比如$x,y,z$改成$a,b,c$,$\triangle DEF$改成$\triangle A'B'C'$之 ...
例如在 Zentralblatt 数学库中搜索公式 zbmath.org/formulae/
\lim_{?a\rightarrow 0} ?x
可以将 ? 添加到变量前以指示可更改的符号
?a+?b = ?b+?a
变量可以出现多次并只匹配相同的符號出现。
?f(?a+?b)
查询变量也允许处于函数名。

418

Threads

1627

Posts

110K

Credits

Credits
11886

Show all posts

abababa Posted at 2025-4-5 21:05:59
hbghlyj 发表于 2025-4-5 21:03
例如在 Zentralblatt 数学库中搜索公式 https://zbmath.org/formulae/
\lim_{?a\rightarrow 0} ?x
可以将 ...
那你说的这个,怎么用在现在的搜索里呢?用不上就没有用啊。

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-4-5 21:13:46
abababa replied at 2025-4-5 14:05
怎么用在现在的搜索里呢?
这是 Zentralblatt 数学公式搜索,Zentralblatt 是數學領域重要的檢索系統之一,提供數學文獻的索引、文摘及評論文章
如果您知道如何实现此类搜索,欢迎添加到论坛的全文搜索

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-4-5 21:19:02

手机版Mobile version|Leisure Math Forum

2025-4-20 12:16 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list