Hi Bratislav, LUCENE-4517 sounds like what you want: <https://issues.apache.org/jira/browse/LUCENE-4517>: "Suggesters: allow to pass a user-defined predicate/filter to the completion searcher"
There's a patch there, against Lucene trunk from about 5 months ago, so if you want to give it a try you'll have to figure out what Subversion revision that was, check it out, apply the patch, then compile. Steve On Mar 14, 2013, at 6:43 PM, Bratislav Stojanovic <bratislav1...@gmail.com> wrote: > Not few of them, I want to know them all. Then I want to iterate through > them and remove ones > that doesn't have id that matches my criteria. In other words, if there's > at least one doc that matches, > I want to show that suggestion. > > Hmm, does it mean that I have to search index with the query = > +id:<suggestion> and then examine each > returned doc? Isn't that gonna be slow because there will be 10 searches on > each key press (I want to always > show 10 suggestions)? > > On Thu, Mar 14, 2013 at 11:21 PM, Jack Krupansky > <j...@basetechnology.com>wrote: > >> Let's refine this... >> >> If a top suggestion is X, do you simply want to know a few of the >> documents which have the highest term frequency for X? >> >> Or is there some other term-oriented metric you might propose? >> >> >> -- Jack Krupansky >> >> -----Original Message----- From: Bratislav Stojanovic >> Sent: Thursday, March 14, 2013 6:14 PM >> To: java-user@lucene.apache.org >> Subject: Re: Getting documents from suggestions >> >> >> Wow that was fast :) >> >> I have implemented a simple search box with auto-suggestions, so whenever >> user >> types in something, ajax call is fired to the SuggestServlet and in return >> 10 suggestions >> are shown. It's working fine with the SpellChecker class, but I only get >> array of Strings. >> >> What I want is to get lucene Document instances so I can use doc.get("id") >> to filter those suggestions. >> This field is my field, doesn't have to do anything with the default Doc. >> Id field Lucene generates. >> >> Here's an example : when I type "apache" I get suggestions like " >> apache.org", >> "apache2" etc. >> Now I want to have something like this : >> Document doc = >> SomeClass.**getDocFromSuggestion("apache.**org<http://apache.org> >> "); >> if (doc.get("id") == ...) { >> //add suggestion into the result >> } else { >> //do nothing. >> } >> >> Is MoreLikeThis designed for this? >> >> On Thu, Mar 14, 2013 at 10:45 PM, Jack Krupansky <j...@basetechnology.com> >> **wrote: >> >> Could you give us some examples of what you expect? I mean, how is your >>> suggested set of documents any different from simply executing a query >>> with >>> the list of suggested terms (using q.op=OR)? >>> >>> Or, maybe you want something like MoreLikeThis? >>> >>> -- Jack Krupansky >>> >>> -----Original Message----- From: Bratislav Stojanovic >>> Sent: Thursday, March 14, 2013 5:36 PM >>> To: java-user@lucene.apache.org >>> Subject: Getting documents from suggestions >>> >>> >>> Hi all, >>> >>> How can I filter suggestions based on some value from the indexed field? >>> I have a stored 'id' field in my index and I want to use that to examine >>> documents >>> where the suggestion was found, but how to get Document from suggestion? >>> SpellChecker class only returns array of strings. >>> >>> What classes should I use? Please help. >>> >>> Thanx in advance. >>> >>> -- >>> Bratislav Stojanovic, M.Sc. >>> >>> ------------------------------****----------------------------** >>> --**--------- >>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.****apache.org< >>> java-user-**unsubscr...@lucene.apache.org<java-user-unsubscr...@lucene.apache.org> >>>> >>> For additional commands, e-mail: java-user-help@lucene.apache.****org< >>> java-user-help@lucene.**apache.org <java-user-h...@lucene.apache.org>> >>> >>> >>> >> >> -- >> Bratislav Stojanovic, M.Sc. >> >> ------------------------------**------------------------------**--------- >> To unsubscribe, e-mail: >> java-user-unsubscribe@lucene.**apache.org<java-user-unsubscr...@lucene.apache.org> >> For additional commands, e-mail: >> java-user-help@lucene.apache.**org<java-user-h...@lucene.apache.org> >> >> > > > -- > Bratislav Stojanovic, M.Sc. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org