lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bratislav Stojanovic <>
Subject Re: Getting documents from suggestions
Date Thu, 14 Mar 2013 22:14:54 GMT
Wow that was fast :)

I have implemented a simple search box with auto-suggestions, so whenever
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 "",
"apache2" etc.
Now I want to have something like this :
Document doc = SomeClass.getDocFromSuggestion("");
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 <>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:
> 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.**<>
> For additional commands, e-mail: java-user-help@lucene.apache.**org<>

Bratislav Stojanovic, M.Sc.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message