On Wed, Dec 30, 2009 at 3:07 AM, Prasanna R <plistma...@gmail.com> wrote:
> I looked into the Solr/Lucene classes and found the required information. > Am summarizing the same for the benefit of those that might refer to this > thread in the future. > > The change I had to make was very simple - make a call to getPrefixQuery > instead of getWildcardQuery in my custom-modified Solr dismax query parser > class. However, this will make a fairly significant difference in terms of > efficiency. The key difference between the lucene WildcardQuery and > PrefixQuery lies in their respective term enumerators, specifically in the > term comparators. The termCompare method for PrefixQuery is more > light-weight than that of WildcardQuery and is essentially an optimization > given that a prefix query is nothing but a specialized case of Wildcard > query. Also, this is why the lucene query parser automatically creates a > PrefixQuery for query terms of the form 'foo*' instead of a WildcardQuery. > > I don't understand this. There is nothing that one should need to do in Solr's code to make this work. Prefix queries are supported out of the box in Solr. > And one final request for Comment to Shalin on this topic - I am guessing > you ensured there were no duplicate terms in the field(s) used for > autocompletion. For our first version, I am thinking of eliminating the > duplicates outside of the results handler that gives suggestions since > duplicate suggestions originate only from different document IDs in our > system and we do want the list of document IDs matched. Is there a > better/different way of doing the same? > > No, I guess not. -- Regards, Shalin Shekhar Mangar.