Hi Joel,
Thanks a lot for the suggestion.
After thinking more about this, I think I could skip the faceting count for now,
and so just provide a filtering option without display how many items that would
be there after filtering. After all, even Google Shopping product search doesn't
display the facet counts :) Given that, I think the easiest way is to add a new
PostFilter to the query.
Thanks again,
Tri
Tri
On Feb 12, 2014, at 12:03 PM, Joel Bernstein <joels...@gmail.com> wrote:
Tri,
You will most likely need to implement a custom QParserPlugin to
efficiently handle what you described. Inside of this QParserPlugin you
could create the logic that would bring in your outside list of ID's and
build a DocSet that could be applied to the fq and the facet.query. I
haven't attempted to use a QParserPlugin with a facet.query, but in theory
it would work.
With the filter query you also have the option of implementing your Query
as a PostFilter. PostFilter logic is applied at collect time so the logic
needs to only be applied to the documents that match the query. In many
cause this can be faster, especially when result sets are relatively small
but the index is large.
Joel Bernstein
Search Engineer at Heliosearch
On Wed, Feb 12, 2014 at 2:12 PM, Tri Cao <tm...@me.com> wrote:
Hi all,I am running a Solr application and I would need to implement a featurethat requires faceting and filtering on a large list of IDs. The IDs arestored outside of Solr and is specific to the current logged on user. Anexample of this is the articles/tweets the user has read in the last fewweeks. Note that the IDs here are the real document IDs and not Luceneinternal docids.So the question is what would be the best way to implement this in Solr?The list could be as large as a ten of thousands of IDs. The obvious way ofrewriting Solr query to add the ID list as "facet.query" and "fq" doesn'tseem to be the best way because: a) the query would be very long, and b) itwould surely exceed that the default limit of 1024 Boolean clauses and Iam sure the limit is there for a reason.I had a similar problem before but back then I was using Lucene directlyand the way I solved it is to use a MultiTermQuery to retrieve the internaldocids from the ID list and then apply the resulting DocSet to counting andfiltering. It was working reasonably for list of size ~10K, and with propercaching, it was working ok. My current application is very invested in Solrthat going back to Lucene is not an option anymore.All advice/suggestion are welcomed.Thanks,Tri