Hello, I have implemented with success a keyword-based search feature with MyFaces / Tomahawk. Tomahawk has an Ajax-based component:
JSF page: <t:div styleClass="menuLevelFloatDiv"> <t:panelGrid columns="3"> <s:inputSuggestAjax styleClass="menuLevelItem" charset="utf-8" autoComplete="false" suggestedItemsMethod="#{searchKeywordBean.getSuggestedKeywords}" style="width=130px;" maxSuggestedItems="10" value="#{searchKeywordBean.userKeyword}"/> <t:commandButton styleClass="menuLevelItem" value="#{msg.searchButton}" onclick="dojoWaitDialogKeyWord.show()" action="#{searchKeywordBean.lookup}"/> <t:commandButton styleClass="menuLevelItem" value="#{msg.queryButton}" action="query"/> </t:panelGrid> </t:div> <%-- wait dialog box --%> <s:modalDialog dialogId="dojoWaitDialogIDKeyWord" dialogVar="dojoWaitDialogKeyWord" dialogAttr="bgColor='white' bgOpacity='0.5' toggle='fade' toggleDuration='250'" styleClass="dojoWaitDialog" hiderIds="okID"> <h:graphicImage styleClass="waitImage" value="images/wait.gif"/> </s:modalDialog> Backing Bean: /** * Suggested keywords for Ajax listbox */ public List<String> getSuggestedKeywords(String userPrefix, Integer maxSize) { List<String> foundKeywords = new ArrayList<String>(); String userPrefixUC = userPrefix.toUpperCase(); .............................................. .............................................. And I do call a Lucene index here. Best, -----Message d'origine----- De : Erick Erickson [mailto:[EMAIL PROTECTED] Envoyé : vendredi 8 juin 2007 16:10 À : java-user@lucene.apache.org Objet : Re: How to implement AJAX search~Lucene Search part? You can get the information pretty quickly by using a WildcardTermEnum (NOT query). Especially if you terminate after some number of characters.... Erick On 6/7/07, Chris Lu <[EMAIL PROTECTED]> wrote: > > Hi, > > I would like to implement an AJAX search. Basically when user types in > several characters, I will try to search the Lucene index and found > all possible matching items. > > Seems I need to use wildcard query like "test*" to matching anything. > Is this the only way to do it? It doesn't seems quite efficient, > especially when you just typed in the first character. > > I guess the "good" way is to go through the terms, and return as soon > as, for example, 10 terms are found. > > I am wondering is there anything like this already built? > > -- > Chris Lu > ------------------------- > Instant Scalable Full-Text Search On Any Database/Application > site: http://www.dbsight.net > demo: http://search.dbsight.com > Lucene Database Search in 3 minutes: > > http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_m inutes > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]