algolia / docsearch

:blue_book: The easiest way to add search to your documentation.
https://docsearch.algolia.com
MIT License
3.95k stars 382 forks source link

Please help me. I can't search anything #2164

Closed g1879 closed 8 months ago

g1879 commented 8 months ago

I can't search anything on my website. But it works fine in search preview. Please help me.Thank you.

My website: https://g1879.gitee.io/drissionpagedocs My crawler:

new Crawler({
  rateLimit: 8,
  maxDepth: 10,
  maxUrls: 5000,
  startUrls: ["https://g1879.gitee.io/drissionpagedocs"],
  renderJavaScript: true,
  sitemaps: ["https://g1879.gitee.io/drissionpagedocs/sitemap.xml"],
  ignoreCanonicalTo: true,
  discoveryPatterns: ["https://g1879.gitee.io/drissionpagedocs/**"],
  schedule: "at 19:18 on Tuesday",
  actions: [
    {
      indexName: "g1879-gitee",
      pathsToMatch: ["https://g1879.gitee.io/drissionpagedocs/**"],
      recordExtractor: ({ helpers }) => {
        return helpers.docsearch({
          recordProps: {
            lvl1: ["header h1", "article h1", "main h1", "h1", "head > title"],
            content: ["article p, article li", "main p, main li", "p, li"],
            lvl0: {
              selectors: "",
              defaultValue: "Documentation",
            },
            lvl2: ["article h2", "main h2", "h2"],
            lvl3: ["article h3", "main h3", "h3"],
            lvl4: ["article h4", "main h4", "h4"],
            lvl5: ["article h5", "main h5", "h5"],
            lvl6: ["article h6", "main h6", "h6"],
          },
          aggregateContent: true,
          recordVersion: "v3",
        });
      },
    },
  ],
  safetyChecks: { beforeIndexPublishing: { maxLostRecordsPercentage: 30 } },
  initialIndexSettings: {
    "g1879-gitee": {
      attributesForFaceting: ["type", "lang"],
      attributesToRetrieve: [
        "hierarchy",
        "content",
        "anchor",
        "url",
        "url_without_anchor",
        "type",
      ],
      attributesToHighlight: ["hierarchy", "content"],
      attributesToSnippet: ["content:10"],
      camelCaseAttributes: ["hierarchy", "content"],
      searchableAttributes: [
        "unordered(hierarchy.lvl0)",
        "unordered(hierarchy.lvl1)",
        "unordered(hierarchy.lvl2)",
        "unordered(hierarchy.lvl3)",
        "unordered(hierarchy.lvl4)",
        "unordered(hierarchy.lvl5)",
        "unordered(hierarchy.lvl6)",
        "content",
      ],
      distinct: true,
      attributeForDistinct: "url",
      customRanking: [
        "desc(weight.pageRank)",
        "desc(weight.level)",
        "asc(weight.position)",
      ],
      ranking: [
        "words",
        "filters",
        "typo",
        "attribute",
        "proximity",
        "exact",
        "custom",
      ],
      highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
      highlightPostTag: "</span>",
      minWordSizefor1Typo: 3,
      minWordSizefor2Typos: 7,
      allowTyposOnNumericTokens: false,
      minProximity: 1,
      ignorePlurals: true,
      advancedSyntax: true,
      attributeCriteriaComputedByMinProximity: true,
      removeWordsIfNoResults: "allOptional",
    },
  },
  appId: "*******",
  apiKey: "*******************",
});
shortcuts commented 8 months ago

Hey, you just leaked your API key :D

shortcuts commented 8 months ago

I can't search anything on my website. But it works fine in search preview. Please help me.Thank you.

you can either:

g1879 commented 8 months ago

It works after disable contextual search. Thank you. However, there are a number of connection failures during the crawl 'HTTP redirect (301, 302)', these urls exist and can be accessed. How should I solve it? thank you. 20240117182222