Idea intellij “USB device not found” Android problem

Lately I’ve been really frustrated with this message. I don’t know when it has started to pop up, but every time I’m in the middle of important debugging, and want to restart the app I get this message when starting the app:

USB device not found

I’ve read bunch of blogs and stackoverflow questions and answers but nothing helped. Then I tried one very simple trick:

adb kill-server
adb devices

After that I’ve got this response:

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
37329B0B96FD00EC    device

After that intellij worked without problems.

Lucene’s Field options (Store and Index), aka RTFM :)

To make a long story short, if you want to make a field act as a database primary key (so you could update/delete a document), create a field with this parameters:

document.add(new Field("id", object.getId(), Store.YES, Index.NOT_ANALYZED));

This was a big RTFM moment for me. I’ve lost a lot of time with this one, and it was really simple. So I guess you are wondering why I didn’t check this :) Well in another project, it was Index.NO instead of Index.NOT_ANALYZED, and I thought that was ok, and checked EVERYTHING else, except that line you see above this text.

So, let’s read the manual together, first the Store options

  • Store.YES – Value is stored in index, so it can be retrieved by an IndexReader.
  • Store.NO – Not stored :)

Now the Index options:

  • Index.No – not indexed, so not searchable (… and in my case, if you don’t index the “ID” field, than it can’t be searchable, which means it can’t be deleted and/or updated)
  • Index.ANALYZED – Field will be indexed, and it will be analyzed (saved as tokens that will be searchable)
  • Index.NOT_ANALYZED – Field will be indexed but in it’s original form (good for things that should be searchable in original form, ID anybody? :))

So, if I got everything right, here are some good combinations:

Store.YES + Index.ANALYZED = In index and analyzed, good for not so big content, such as a title and some short intro text (first few lines you see in a blog, before you go to that post)

Store.NO + Index.ANALYZED = Not stored in index, but analyzed and searchable, so pretty good for big text (content)

Store.YES + Index.NOT_ANALYZED = Stored in index in it’s original form, great for IDs :)

If I got something wrong, feel free to point that out (in comments or hate mail), also if you got lucene tips, please share :D