You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jonathan Hendler <jo...@gmail.com> on 2009/10/26 22:06:38 UTC

Using Solr for term-completion with counts

Greetings all,

We're happily migrating our MySQL fulltext search to SOLR/faceted  
search.

We're doing a term suggest on a large text field and doing  
facet.sort=count. The numbers returned represent total times the term  
shows up - I'd like to have the numbers represent the total documents  
(unique ids) containing the term instead. Can I do this through a  
facet query or another param ? I didn't see this example on the wiki  
or the new book.

In other words to return Math(12 documents) instead of Math(93 times  
word shows up)
query=(+Ma*) 
&facet.prefix 
="Ma"&facet.field=large_index_of_text&facet.sort=count&facet.mincount=1

- Jonathan

Re: Using Solr for term-completion with counts

Posted by Jonathan Hendler <jo...@gmail.com>.
Yonik, Thanks.

One question inline below:

On Oct 26, 2009, at 5:30 PM, Yonik Seeley wrote:
>
>> Can I do this through a facet query or another param ?
>
> Faceting should also work... the terms component is very much like the
> faceting component except that it always works over the complete index
> (including deleted docs!) instead of a subset of it.

  Aren't deleted docs purged on delta updates? Maybe I misunderstand  
what you're describing above?


>
> -Yonik
> http://www.lucidimagination.com


Re: Using Solr for term-completion with counts

Posted by Yonik Seeley <ys...@gmail.com>.
On Mon, Oct 26, 2009 at 5:06 PM, Jonathan Hendler
<jo...@gmail.com> wrote:
> Greetings all,
>
> We're happily migrating our MySQL fulltext search to SOLR/faceted search.
>
> We're doing a term suggest on a large text field and doing facet.sort=count.
> The numbers returned represent total times the term shows up - I'd like to
> have the numbers represent the total documents (unique ids) containing the
> term instead.

That is what you're getting... the docfreq (the number of documents)
that contain the term.

> Can I do this through a facet query or another param ?

Faceting should also work... the terms component is very much like the
faceting component except that it always works over the complete index
(including deleted docs!) instead of a subset of it.

-Yonik
http://www.lucidimagination.com

Re: Using Solr for term-completion with counts

Posted by Jonathan Hendler <jo...@gmail.com>.
Hi David, (and Yonik)

Thanks for the quick responses. The book is quite comprehensive. Nice  
work.

Looks like I misinterpreted my own results - totally a user error. (I  
guess that's a good way to introduce yourself to a mailing list. )

I had used the example on page 156. My error:  documents returned by  
another search function of ours had counts which were much lower  
numbers because they include restrictions put in place by an ACL, so I  
was getting much larger numbers in the autocomplete (which don't use  
the ACL).

Thanks again.

- Jonathan




On Oct 26, 2009, at 5:56 PM, David Smiley @MITRE.org wrote:

>
> Jon, there actually is an example of this in my book.  Go to page  
> 156.  I
> looked and found "term-suggest" in the index.
>
> ~ David Smiley
> Author: http://www.packtpub.com/solr-1-4-enterprise-search-server/
>
>
> Jonathan Hendler-3 wrote:
>>
>> Greetings all,
>>
>> We're happily migrating our MySQL fulltext search to SOLR/faceted
>> search.
>>
>> We're doing a term suggest on a large text field and doing
>> facet.sort=count. The numbers returned represent total times the term
>> shows up - I'd like to have the numbers represent the total documents
>> (unique ids) containing the term instead. Can I do this through a
>> facet query or another param ? I didn't see this example on the wiki
>> or the new book.
>>
>> In other words to return Math(12 documents) instead of Math(93 times
>> word shows up)
>> query=(+Ma*)
>> &facet.prefix
>> = 
>> "Ma 
>> "&facet.field=large_index_of_text&facet.sort=count&facet.mincount=1
>>
>> - Jonathan
>>
>
> -- 
> View this message in context: http://www.nabble.com/Using-Solr-for-term-completion-with-counts-tp26067641p26068424.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Using Solr for term-completion with counts

Posted by "David Smiley @MITRE.org" <DS...@mitre.org>.
Jon, there actually is an example of this in my book.  Go to page 156.  I
looked and found "term-suggest" in the index.

~ David Smiley
 Author: http://www.packtpub.com/solr-1-4-enterprise-search-server/


Jonathan Hendler-3 wrote:
> 
> Greetings all,
> 
> We're happily migrating our MySQL fulltext search to SOLR/faceted  
> search.
> 
> We're doing a term suggest on a large text field and doing  
> facet.sort=count. The numbers returned represent total times the term  
> shows up - I'd like to have the numbers represent the total documents  
> (unique ids) containing the term instead. Can I do this through a  
> facet query or another param ? I didn't see this example on the wiki  
> or the new book.
> 
> In other words to return Math(12 documents) instead of Math(93 times  
> word shows up)
> query=(+Ma*) 
> &facet.prefix 
> ="Ma"&facet.field=large_index_of_text&facet.sort=count&facet.mincount=1
> 
> - Jonathan
> 

-- 
View this message in context: http://www.nabble.com/Using-Solr-for-term-completion-with-counts-tp26067641p26068424.html
Sent from the Solr - User mailing list archive at Nabble.com.