Quick Search API Sample

I noticed in recent builds that the appearance of the new 6.5 Quick Search feature has improved recently. It looks a lot better and provides more functionality. First, you can see in the final category below that there is a "..." elipsis if the list of results is longer than the length of the visible list:

So you can click on that elipsis and see all the results. Also, if you're looking at the screenshot above and wondering: "He typed 'tip' but several of the results do NOT have 'tip' in the title," then you should look at this screenshot:

Here you can see that the search string "lookup" is in NONE of the returned titles. However, I happen to know for a fact that "lookup" is mentioned in the content of each of the above items, which means that the search does more than a title search, it actually looks into the body of the help topics, which is great news.

Finally, the categories are shown like this, so that you can limit the search to the category of your choice:

And maybe you're wondering about the categories "User FAQs" and "NetBeans Zone" in the screenshots above? Those come from the sample I'm turning into a tutorial describing the API that makes the above integrations possible. It is to be called "Quick Search Integration Tutorial" and will hopefully be available at the beginning of next week. However, the sample code is already available in the Plugin Portal:

http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=11179

Remember that you'll need a recent 6.5 build (Milestone 1 should be fine, I think) if you want to play with the sample.

Comments:

Dear Geertjan, how to use quick search panel in a custom form. For example I have a list of clients, and a JPanel (on TopComponent) with a TextField named "Client". I want to equip this field or replace it with a field like in quick search.

Posted by Alexander on June 03, 2010 at 05:46 PM PDT #

Hello Geertjan. I'm having some problems with my implementation of this API. I got the searchprovider set up correctly and the application searches beutifully amongst my customers and articles.

But.

When the search has found a article, for example, I have a action that opens that article in my articleeditor. When i open the article, the quicksearch textfield says, "( no results )", in evil red text.

Do you have any idea of why this is?

Posted by Ingemar Skelander on April 05, 2013 at 05:51 AM PDT #

Got the same "no results" error issue though the search found a few results. Any insight will be much appreciated. Cheers.

Posted by guest on April 13, 2013 at 07:41 AM PDT #

You're saying that you followed this tutorial?

https://platform.netbeans.org/tutorials/nbm-quick-search.html

Posted by Geertjan on April 13, 2013 at 08:30 AM PDT #

Tried it in NetBeans Platform 7.3. Works perfectly. So if you're not going to provide code showing the problem, I'm not going to be able to help.

Posted by Geertjan on April 13, 2013 at 08:46 AM PDT #

Hello again Geertjan. I will provide some sample code of the SearchProvider.

public class ArticleSearchProvider implements SearchProvider {

@Override
public void evaluate(SearchRequest request, SearchResponse response)

{
List<Article> allArticles = findAllArticles() // not the real call
List<Article> viableResults = new ArrayList<Article>();
for (Article article : articles) {
if (isCompatibleId(article, request)) {
viableResults.add(article);
} else if (isCompatibleName(article, request)) {
viableResults.add(article);
} else if (isCompatiblePrice(article, request)) {
viableResults.add(article);
}
}

for (Article article : viableResults) {
ArticleAction articleAction
= new ArticleAction(viableResults, article);

if(!response.addResult(articleAction, article.getName() + " " +
article.getNumber())) {
return;
}
}
}
}

and the Runnable, ArticleAction, just posts the selected article to the global lookup where it is processed and the articleeditor opens with the selected article.

Sorry that the formatting of the code is kinda messed up.

Posted by Ingemar Skelander on April 15, 2013 at 06:35 AM PDT #

Just answer the question, please. Did you follow the tutorial? Ignoring your comments until you answer the question. Also, just join the dev mailing list and ask your questions there.

Posted by Geertjan on April 15, 2013 at 06:48 AM PDT #

Sorry, I forgot to answer the tutorial question. Yes I followed the tutorial. I will join the mailing list, so no point in continuing here.
Thanks.

Posted by Ingemar Skelander on April 15, 2013 at 07:31 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today