ajermakovics / eclipse-instasearch

Eclipse plug-in for fast code search
http://marketplace.eclipse.org/content/instasearch
Eclipse Public License 2.0
170 stars 48 forks source link

Exact search misses results #21

Open dragos opened 11 years ago

dragos commented 11 years ago

I totally love the speed of this plugin. InstaSearch is a good name!

However, I can't get exact search to work properly. Is it supposed to find phrases with spaces, if they are enclosed in quotes? For instance "new MethodClassifier" does not find anything, even though there are lots of matches in the editor I have open.

screenshot

ajermakovics commented 11 years ago

You should be able to search without the quotes and exact search matches should appear at the top. Is it not the case? Which version are you using btw?

dragos commented 11 years ago

Thanks for the reply. I tried without the quotes, but it showed me too many results that were not exact. I think it still shows them sometimes, maybe right after opening a closed project (I suspect that indexing is not done yet).

I am using the latest released version (I think), 1.4.0.

dipakc commented 11 years ago

I am also facing this issue. If I search for def mymethod then the search result has all the files that contain the words def and mymethod. Now def is there in almost all the files and many files have a calls to the mymethod method. So the desired file (i.e. the file containing the exact phrase def mymethod) is not in the top 10 search results.

Will this functionality be too difficult to implement with lucene? I think lucene has PhraseQuery for this purpose.

Instasearch version 1.4.0

sandos commented 11 years ago

I did a bit more thorough test, with the successful ones at the top and after the comment the ones that does not. Just try searching for the long line, and see if the line below also gets a hit. Tested with 1.5.

So there is a lot of separators that makes exact matches not work. Not sure if we want every single one to work (Would this bloat the index too much?)

//phrase_search_works
//phrase
//That.works.too
//That
//Also-this-works
//Also
//Mult*3
//Mult
//Plus+2
//Plus

// Examples that does not work
//this:does:not:work
//this
//How"about"Some"
//How
//Comma,is,bad
//Comma
//Space also breaks this
//Space
//And[What[About[Some[Arrays
//And
//Or{some{codeblocks
//Or
//Lisp(IsGood
//Lisp
//Logical&&stuff
//Logical
//Comments#wooh
//Comments
//Xml<forya
//Xml
//About~right
//About
//Div/7
//Div
aJanuary commented 11 years ago

If I search for "failed to transfer parcel with id" it shows only files that match the entire string "failed to transfer parcel with id". Within each of those files:

m-kumaran commented 11 years ago

Hi I am using STS 3.2.0 RELEASE Build Id: 201303060821 with this plugin version 1.5.2.

When I search for exact match like "failed to switch" the results in the InstaSearch view showing lot of other lines where individual word is found. For example I don't want the line with "failed for some reason". There is a score hint which shows 99 for the line which I am interested and the other lines have got less scores.

Is there anyway I can filter this score? Should I use raw lucene syntax for this? Is there anyway I can set that I need just exact match alone?

Thanks in advance. -Kum

ajermakovics commented 10 years ago

Exact searches is slightly tricky because we also want to support non-exact searches as well. For non-exact searches (parts of words) all words in code are split (FileAnalyzer.java). On the other hand, some exact searches nevertheless work as expected (SearcherTest.java).

I suppose one option is to store exact (unsplit) words in a separate index and then search it first. If no matches found use default index.

rupebac commented 10 years ago

tricky? this is very simple, when I am looking for "String myVariable" I want it to show up those lines with that text.... When I am looking for String*myVariable then anything in the line with that regex... There is a reason why regular expressions are there....

ajermakovics commented 10 years ago

@lqbweb it doesn't use regular expressions for searching. not sure what you are proposing

nill14 commented 9 years ago

How about introducing LineTokenizer? Would it solve the exact phrase (including brackets, spaces, semicolons) problem?

dragos commented 9 years ago

I stopped using this plugin. Since the Luna release, text search is fast enough for me.