Think about ngrams if you really need infix searches, you're right that the regex is very probably the root of your problem. The index has to examine *every* term in the field to determine if the regex will match.
Best Erick On Tue, Sep 20, 2011 at 12:57 AM, roySolr <royrutten1...@gmail.com> wrote: > Hello, > > I used the terms request for autocomplete. It works fine with 200.000 > records but with 2 million docs it's very slow.. > > I use some regex to fix autocomplete in the middle of words, example: chest > -> manchester. > > My call(pecl PHP solr): > > $query = new SolrQuery(); > $query->setTermsLimit("10"); > > $query->setTerms(true); > $query->setTermsField($field); > > $term = SolrUtils::escapeQueryChars ($term); > $query->set("terms.regex","(.*)$term(.*)"); > $query->set("terms.regex.flag","case_insensitive"); > > URL: > /solr/terms?terms.fl=autocompletewhat&terms.regex=(.*)chest(.*)&terms.regex.flag=case_insensitive&terms=true > > I think the regex is the reason for the very high query time: Solr search > between 2 million docs with a regex. The query takes 2 seconds, this is to > much for the autocomplete. A user typed "manchester united" and solr needs > to do 16 query's from 2 seconds. Are there some other options? Faster > solutions? > > I use solr 3.1 > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Slow-autocomplete-terms-tp3351352p3351352.html > Sent from the Solr - User mailing list archive at Nabble.com. >