Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Fundamental Indexing #1483

Merged
merged 18 commits into from
Dec 4, 2023
Merged

Conversation

tom-ludwig
Copy link
Member

@tom-ludwig tom-ludwig commented Nov 18, 2023

Overview

This PR introduces indexing, enhancing CE's search capabilities by indexing files and enabling efficient keyword searches.

TL;DR: Significant search time reduction from 5 sec to 0.09 sec (with usage preview) and 0.007 sec (without preview). Indexing process completes in just 0.1 sec. Tested on CE 16.10.23

Description

I've hooked up Search Kit to supercharge CodeEdit's search game. What's that mean for you? Well, we're talking about a behind-the-scenes indexing party. When you throw a search query, CodeEdit now uses this index it built earlier, slashing search times.

For instance, finding 'struct' used to take a sluggish 5 seconds in our 29,000 lines of code. Now? Blink, and you'll miss it—0.09 seconds, even with a usage preview, this not only locates the file but also identifies usages within the found files.! Skip the usage preview, and it's a blink-and-you'll-really-miss-it 0.007 seconds. And guess what? The startup indexing takes just 0.1 seconds.

How It Works

Curious about the magic under the hood? Here's the simplified rundown:
SearchKit diligently maps every term to a document using inverted indexing, creating a handy map of where each term appears. When you search, CodeEdit skips sifting through files directly. Instead, it goes straight to the index, like a well-organised library catalog. Your searches are now lightning-fast. CodeEdit doesn't need to scan every file; it already knows where to find what you're looking for. For more info check out: SearchKit Documentation
and Documentation Archive

FYI: I'll throw in some tests in another PR after this one gets the green light.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code
  • Enhance async usage for improved efficiency and responsiveness.
  • Utilise the function for searching in CE
  • Integrate async search result retrieval

Screenshots

Screenshot 2023-11-18 at 1 13 12 PM

@tom-ludwig tom-ludwig marked this pull request as ready for review November 24, 2023 18:27
@tom-ludwig
Copy link
Member Author

@austincondiff Search on M1 MacBook Air is as quick as on my M1 Max. All good now!

Copy link
Collaborator

@thecoolwinter thecoolwinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one small bug and a couple quick spelling errors. Super excited to get this merged!

Copy link
Collaborator

@0xWDG 0xWDG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Nice work 🎉

Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Very nice work @activcoding! 👏

@austincondiff austincondiff merged commit bbcc8c0 into CodeEditApp:main Dec 4, 2023
2 checks passed
@thecoolwinter thecoolwinter added the enhancement New feature or request label Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants