Live data from Hacker News

Fast Search Using PostgreSQL Trigram Indexes

about.gitlab.com

31–33 of 33 posts

Re: Fast Search Using PostgreSQL Trigram Indexes

#31

ah yes, the old 're-implement the search engine inside the database' project, undoubtedly put up on the board because someone is tired of their get-the-data-from-the-database-to-the-search-engine process breaking constantly. next on the map: discovering how shitty dictionary management is, the joys of NLP, and abandoning the project entirely because you realize all this stuff has already been solved in 3 or 4 differe…

the joys of NLP ... this is a search index for Gitlab, that's used primarily to store code , not natural language. Looking at its competitor, Github's search engine clearly has a base in NLP, and ditches many punctuation characters ( https://help.github.com/articles/searching-code/ ) - which are way more important in code than they are in English - for example, I can't search for code containing "$/" when it should h…

sure, primarily code. except when code contains language, like in comments, and other related documentation that's stored in-repo. and of course, people are going to completely mis-use the repo to store ancillary human-readable binary documents, which will need to be converted, indexed, searched, updated, purged, etc, etc...

since developers tag, reference, and document their code with comments, they're going to expect the full suite of NLP treatments with all indexed content, including code.

which basically means: you'll have to tokenize out the special characterize for NLP, but retain them for literal code searches, thereby increasing the size of the inverted index for every permutation of the desired search criteria.

maybe you can detect and filter out all the comments, and index them separately, or maybe have some kind of dual system where the NL indexing system exists separately from the code indexing system ... you see where this is going?

Re: Fast Search Using PostgreSQL Trigram Indexes

#32

Trigrams are a very straightforward solution to this but they have one major limitation: They break with misspellings / alternative spellings. For example the words "vodka" and "votka" share no trigrams yet are obviously very similar. I recently worked on this problem for a project and came up with a more robust solution using pre-computed Levenshtein indexes. You've probably heard of Levenshtein distance as a measur…

What do you recommend instead of LevelDB?

Re: Fast Search Using PostgreSQL Trigram Indexes

#33

Earlier quoted context omitted.

the joys of NLP ... this is a search index for Gitlab, that's used primarily to store code , not natural language. Looking at its competitor, Github's search engine clearly has a base in NLP, and ditches many punctuation characters ( https://help.github.com/articles/searching-code/ ) - which are way more important in code than they are in English - for example, I can't search for code containing "$/" when it should h…

sure, primarily code. except when code contains language, like in comments, and other related documentation that's stored in-repo. and of course, people are going to completely mis-use the repo to store ancillary human-readable binary documents, which will need to be converted, indexed, searched, updated, purged, etc, etc... since developers tag, reference, and document their code with comments, they're going to expe…

they're going to expect the full suite of NLP treatments with all indexed content, including code. Nope. In 30 years of searching through code, I've never once felt the need for that. On the other hand, almost every time I use Github search, I find the limitations of a word-oriented index get in the way (looking for partial keywords to find code relevant to an api, etc. It's not just special characters).
Post reply on HN