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 Jeff Schmidt <ja...@535consulting.com> on 2011/07/06 17:54:51 UTC

Obtaining document IDs used in facet value count

I need to take a new approach on accessing my Solr index.  It's indexed where each document is a biological node (drug, gene etc.). Each has multi-valued fields for disease and species and other things. To keep the question as simple as possible let's just worry about disease.

I'm faceting on the  disease field.  My original plan is to present node search results, returning (thus stored) and faceting (indexed) on disease and other fields. That all works great, but now the requirement is to be able to determine which nodes have disease x, y, z...  That is, in a graphical viewer, we want to allow the user to click on, say, "diabetes", and highlight the set of nodes pertaining to a given disease.  The viewer requires information like:

	diabetes -> nodeId1, nodeId2, nodeId3
	neoplasia -> nodeId1, nodeId123
	pancreatic cancer -> NodeId3, nodeId5

Where nodeIdx is just the document ID.

I can see how I could get all the of diseases for all nodes in the set, and go through the SolrDocuments and compile the disease to node mappings myself.  Or, I could query Solr and specify the diseases for which to return nodes. Perhaps that would be a single query, or one per disease?

But, faceting on disease gives me the document count for each disease type. Is there a way I can use the faceting functionality and get the document IDs rather than just a count?  Solr must know the IDs are some point in calculating the facet count.

Thanks!

Jeff
--
Jeff Schmidt
535 Consulting
jas@535consulting.com
http://www.535consulting.com
(650) 423-1068