lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Finding documents with undefined field
Date Wed, 07 Jun 2006 19:43:50 GMT

: actually I've developed my own FacetRequestHandler extending the query
: format and adding a showfacet parameter (it's a little custom on our needs,
: but I'd like to publish it when we have finished).

I'd love to see more cutom request handlers ... it's always good to know
i'm not the oly one out there writing them :)

: Then, if requested with showfacets parameter, I get facets extracting and
: parsing a facetXML descriptor from a facet-type document in the index,
: querying for the facet descriptor of the current category i get from the
: filter list (similar to CNET, i think).

yeah, it certianly sounds like it.

: Now, how could I get a fiter for the missing field ?
: Can I use the unbounded range trick simply adding a facet (and filter) like
: this:
:
:     facetCount = searcher.numDocs(QueryParsing.parseQuery("-fieldName:[* TO
: *]", "", req.getSchema()), results.docSet);

I'm pretty sure that won't work s is ... you'll run inot hte sam problem i
was talking about before: your query doesn't positively select anything
(the sole negatived clause just regects things)

There are a couple of things you can do here...

1) Use the same approach i described before if you have a uniqueKey,
search for all things with a key and then exclude things that have a value
in your field.  Since you are writing a request handler, you could also
progromaticaly build up a BooleanQuery containing a MatchAllDocsQuery
object and your prohibited clause even if you don't have a uniqueKey

2) you can fetch the DocSet of all documents that *do* have a value for
that field, and then get the inverse, and use that for your facet counts.
this is something that was discussed before in a thread Erik started...

http://www.nabble.com/request-handler-and-caches-t1593321.html#a4343055

Getting the inverse of a DocSet is currently not a built in operation, you
have to use the getBits() method and operate on it, something like this
should work...

  DocSet definedSet = search.getDocSet(parseQuery("field:[* TO *]"));
  DocSet unDefinedSet = new BitDocSet(fieldDefinedSet.getBits().flip(0,search.maxDoc()))
  int count = unDefinedSet.intersectionCount(results.docSet)

...at least, i think it should work .. i've never really had to worry
about inverted sets.


-Hoss


Mime
View raw message