Also just took a quick look at the code. This will likely be a performance
problem if you have a large result set:

String classif = context.reader().document(docId).get("classification");

Instead of using the stored field, you'll want to get the BytesRef for the
field using either the FieldCache or DocValues. Recent releases of
DocValues will likely be the fastest docID->BytesRef lookup.



Joel Bernstein
Search Engineer at Heliosearch

On Wed, Oct 8, 2014 at 2:20 PM, Christopher Gross <cogr...@gmail.com> wrote:

> That did the trick!  Thanks Joel.
>
> -- Chris
>
> On Wed, Oct 8, 2014 at 2:05 PM, Joel Bernstein <joels...@gmail.com> wrote:
>
> > The results are being cached in the QueryResultCache most likely. You
> need
> > to implement equals() and hashCode() on the query object, which is part
> of
> > the cache key. In your case the creds param must be included in the
> > hashCode and equals logic.
> >
> > Joel Bernstein
> > Search Engineer at Heliosearch
> >
> > On Wed, Oct 8, 2014 at 1:17 PM, Christopher Gross <cogr...@gmail.com>
> > wrote:
> >
> > > Code:
> > > http://pastebin.com/tNjzDbmy
> > >
> > > Solr 4.9.0
> > > Tomcat 7
> > > Java 7
> > >
> > > I took Erik Hatcher's example for creating a PostFilter and have
> modified
> > > it so it would work with Solr 4.x.  Right now it works...the first
> time.
> > > If I were to run this query it would work right:
> > >
> > >
> >
> http://localhost:8080/solr/plugintest/select?q=*:*&sort=uniqueId%20desc&fq={!classif%20creds=ABC}
> > > However, if I ran this one:
> > >
> > >
> >
> http://localhost:8080/solr/plugintest/select?q=*:*&sort=uniqueId%20desc&fq={!classif%20creds=XYZ}
> > > I would get the results from the first query.  I could do a different
> > > query, like:
> > > http://localhost:8080/solr/plugintest/select?q=uniqueId[* TO
> > > *]&sort=uniqueId%20desc&fq={!classif%20creds=XYZ}
> > > and I'd get the XYZ tagged items.  But if I tried to find ABC with that
> > > one:
> > > http://localhost:8080/solr/plugintest/select?q=uniqueId[* TO
> > > *]&sort=uniqueId%20desc&fq={!classif%20creds=ABC}
> > > it would just list the XYZ items.
> > >
> > > I'm not sure what is persisting where to cause this to happen.  Anybody
> > > have some tips/pointers for building filters like this for Solr 4.x?
> > >
> > > Thanks!
> > >
> > > -- Chris
> > >
> >
>

Reply via email to