diff --git a/.changeset/cuddly-rabbits-fly.md b/.changeset/cuddly-rabbits-fly.md new file mode 100644 index 0000000..cf1c5f3 --- /dev/null +++ b/.changeset/cuddly-rabbits-fly.md @@ -0,0 +1,5 @@ +--- +"neogrok": patch +--- + +Expand and enhance documentation on /about and /syntax diff --git a/src/lib/doc-section-heading.svelte b/src/lib/doc-section-heading.svelte new file mode 100644 index 0000000..90a697c --- /dev/null +++ b/src/lib/doc-section-heading.svelte @@ -0,0 +1,15 @@ + + + + + + + diff --git a/src/lib/example-query.svelte b/src/lib/example-query.svelte index 0b7b423..63019bc 100644 --- a/src/lib/example-query.svelte +++ b/src/lib/example-query.svelte @@ -3,8 +3,13 @@ import Expression from "./expression.svelte"; export let query: string; export let wrap = false; + export let page: "search" | "repositories" = "search"; - + {query} diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte index 44981fc..22516e8 100644 --- a/src/routes/about/+page.svelte +++ b/src/routes/about/+page.svelte @@ -1,5 +1,7 @@ @@ -15,18 +17,119 @@ of a modern, snappy UI.

- As an added bonus, neogrok can serve as a replacement for existing - deployments of - OpenGrok, a much older, - more intricate, slower, and generally jankier code search engine than zoekt. - Neogrok strives to provide URL compatibility with OpenGrok by redirecting - OpenGrok URLs to their neogrok equivalents: simply deploy neogrok at the - same origin previously hosting your OpenGrok instance, and everything will - Just Work™. (Perfect compatibility is not possible as the feature sets of - each search engine do not map one-to-one.) -

-

- To see the source code and more detailed documentation, check out the - project on GitHub. + This page describes the functionality of this neogrok site. To see the + source code and more detailed documentation on configuring and deploying + neogrok, check out the project on GitHub.

+ +
+ Code search +

+ The main/home page of the site is the code search page. + Here you can enter a search query in the zoekt syntax, which is a complicated + enough topic that it gets its own page. +

+
+ Live search +

+ One of the selling points of neogrok and zoekt is speed. So, by default, + search is live: every character you type into the search inputs + will execute a new query. If you prefer to not have live search, there + is a button in the search form that toggles between live and + manual + search. When manual search is enabled, the search query can instead be executed + by pressing the enter/return key, and any search inputs that have pending + changes are highlighted in yellow. +

+
+
+ Search results +

+ Search results consist of N matches for the query across M + files, where N ≥ M. Matches can occur not only in file contents, + but in file paths as well. As a search engine, zoekt attempts to rank + results by a relevancy score: it will return the highest scoring file + first. The scoring mechanisms of zoekt are opaque and unspecified. +

+

+ Unlike some other search engines, zoekt does not paginate search + results. To prevent both neogrok and your browser from being + overwhelmed, the number of results returned from zoekt to neogrok are + limited by the files and matches inputs. Zoekt collects + the top N matches across the top M files, stopping whenever + it meets either of these two limits, and sends the truncated results to neogrok. +

+

+ The search results header thus describes how many files and matches for + the query zoekt found, and how many it sent to neogrok. It will show + which of the files and matches inputs are the current limiting + factor on the truncated results by highlighting the relevant count in the + header. You can get more results by increasing the relevant limit in its + input. +

+
+
+ Other search inputs +
+

+ Finally, there are a few more inputs in the search form that control + how search results are displayed: +

+
    +
  • + In addition to the live/manual toggle button, there is another + toggle button that affects the ordering of matches within a file. + Zoekt not only ranks files in search results, but also ranks matches + within each file. By default, neogrok ignores this ranking and + displays matches ordered by line number, but you may use this button + to switch to ordering matches by score. +
  • +
  • + You can set the number of lines of context around matches in + file contents; this has the same semantics as + grep's + -C + flag. +
  • +
+
+
+
+ +
+ Repositories list +

+ The repositories list page tabulates all of + the repositories indexed in the backing zoekt instance, including a variety + of data about them. +

+

+ Note that the search input on this page has the same semantics as the + search input on the main search page: you are writing a full zoekt query, but instead of getting normal search results, you get repositories that + contain any results matching the query. So, filters the table to repositories with "linux" in their name, while filters the table to repositories with linux in their + contents. +

+
+ +
+ Preferences +

+ The preferences page allows you to persistently + configure some aspects of the neogrok UI. Preferences configured here are stored + in browser cookies and are updated instantly upon interacting with any of the + inputs. +

+
diff --git a/src/routes/syntax/+page.svelte b/src/routes/syntax/+page.svelte index b60a0f8..5b28089 100644 --- a/src/routes/syntax/+page.svelte +++ b/src/routes/syntax/+page.svelte @@ -2,7 +2,7 @@ import Link from "$lib/link.svelte"; import ExampleQuery from "$lib/example-query.svelte"; import Expression from "$lib/expression.svelte"; - import Heading from "./heading.svelte"; + import Heading from "$lib/doc-section-heading.svelte"; diff --git a/src/routes/syntax/heading.svelte b/src/routes/syntax/heading.svelte deleted file mode 100644 index 8da4508..0000000 --- a/src/routes/syntax/heading.svelte +++ /dev/null @@ -1,9 +0,0 @@ - - -

- - - -