earwig / bitshift

A semantic search engine for source code
https://bitshift.benkurtovic.com/
MIT License
30 stars 5 forks source link

Limit returned codelet line-lengths. #77

Open sevko opened 10 years ago

sevko commented 10 years ago

Returning codelet results that are over a thousand lines long is somewhat senseless, because, if a user requires all relevant matches for a symbol, they'll probably ultimately resort to downloading the file from its source and operating on it manually (and more efficiently). Capping the codelets the client receives at a length of 1,000 lines would also decrease load/syntax-highlighting times.

The excerpt of the codelet that we return needs to be intelligently selected -- optimally, so that the number of matches it contains is maximized, but we can settle for a simpler algorithm because it doesn't much of a difference.