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 PeterKerk <ve...@hotmail.com> on 2010/08/19 14:09:24 UTC

Showing results based on facet selection

I have indexed all data (as can be seen below).

But now I want to be able to simulate when a user clicks on a facet value,
for example clicks on the value "Gemeentehuis" of facet "themes_raw" AND has
a selection on features facet on value "Strand"

I've been playing with facet.query function:
facet.query=themes_raw:Gemeentehuis&facet.query=features_raw:Strand

But without luck.

{
 "responseHeader":{
  "status":0,
  "QTime":0,
  "params":{
	"facet":"true",
	"fl":"id,title,city,score,themes,features,official,services",
	"indent":"on",
	"q":"*:*",
	"facet.field":["province_raw",
	 "services_raw",
	 "themes_raw",
	 "features_raw"],
	"wt":"json"}},
 "response":{"numFound":3,"start":0,"maxScore":1.0,"docs":[
	{
	 "id":"1",
	 "title":"Gemeentehuis Nijmegen",
	 "services":[
	  "Fotoreportage"],
	 "features":[
	  "Tuin",
	  "Cafe"],
	 "themes":[
	  "Gemeentehuis"],
	 "score":1.0},
	{
	 "id":"2",
	 "title":"Gemeentehuis Utrecht",
	 "services":[
	  "Fotoreportage",
	  "Exclusieve huur"],
	 "features":[
	  "Tuin",
	  "Cafe",
	  "Danszaal"],
	 "themes":[
	  "Gemeentehuis",
	  "Strand & Zee"],
	 "score":1.0},
	{
	 "id":"3",
	 "title":"Beachclub Vroeger",
	 "services":[
	  "Exclusieve huur",
	  "Live muziek"],
	 "features":[
	  "Strand",
	  "Cafe",
	  "Danszaal"],
	 "themes":[
	  "Strand & Zee"],
	 "score":1.0}]
 },
 "facet_counts":{
  "facet_queries":{},
  "facet_fields":{
	"province_raw":[
	 "Gelderland",1,
	 "Utrecht",1,
	 "Zuid-Holland",1],
	"services_raw":[
	 "Exclusieve huur",2,
	 "Fotoreportage",2,
	 "Live muziek",1],
	"themes_raw":[
	 "Gemeentehuis",2,
	 "Strand & Zee",2],
	"features_raw":[
	 "Cafe",3,
	 "Danszaal",2,
	 "Tuin",2,
	 "Strand",1]},
  "facet_dates":{}}}

-- 
View this message in context: http://lucene.472066.n3.nabble.com/Showing-results-based-on-facet-selection-tp1223362p1223362.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Showing results based on facet selection

Posted by PeterKerk <ve...@hotmail.com>.
Hi Markus,

Thanks for the quick reply. it works now! :)
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Showing-results-based-on-facet-selection-tp1223362p1225626.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Showing results based on facet selection

Posted by Markus Jelsma <ma...@buyways.nl>.
Hi,

 

A facet query serves a different purpose [1]. You need to filter your result set [2]. And don't forget to follow the links on caching and such.

 

[1]: http://wiki.apache.org/solr/SimpleFacetParameters#facet.query_:_Arbitrary_Query_Faceting

[2]: http://wiki.apache.org/solr/CommonQueryParameters#fq
 

Cheers, 
-----Original message-----
From: PeterKerk <ve...@hotmail.com>
Sent: Thu 19-08-2010 14:10
To: solr-user@lucene.apache.org; 
Subject: Showing results based on facet selection


I have indexed all data (as can be seen below).

But now I want to be able to simulate when a user clicks on a facet value,
for example clicks on the value "Gemeentehuis" of facet "themes_raw" AND has
a selection on features facet on value "Strand"

I've been playing with facet.query function:
facet.query=themes_raw:Gemeentehuis&facet.query=features_raw:Strand

But without luck.

{
"responseHeader":{
 "status":0,
 "QTime":0,
 "params":{
"facet":"true",
"fl":"id,title,city,score,themes,features,official,services",
"indent":"on",
"q":"*:*",
"facet.field":["province_raw",
"services_raw",
"themes_raw",
"features_raw"],
"wt":"json"}},
"response":{"numFound":3,"start":0,"maxScore":1.0,"docs":[
{
"id":"1",
"title":"Gemeentehuis Nijmegen",
"services":[
 "Fotoreportage"],
"features":[
 "Tuin",
 "Cafe"],
"themes":[
 "Gemeentehuis"],
"score":1.0},
{
"id":"2",
"title":"Gemeentehuis Utrecht",
"services":[
 "Fotoreportage",
 "Exclusieve huur"],
"features":[
 "Tuin",
 "Cafe",
 "Danszaal"],
"themes":[
 "Gemeentehuis",
 "Strand & Zee"],
"score":1.0},
{
"id":"3",
"title":"Beachclub Vroeger",
"services":[
 "Exclusieve huur",
 "Live muziek"],
"features":[
 "Strand",
 "Cafe",
 "Danszaal"],
"themes":[
 "Strand & Zee"],
"score":1.0}]
},
"facet_counts":{
 "facet_queries":{},
 "facet_fields":{
"province_raw":[
"Gelderland",1,
"Utrecht",1,
"Zuid-Holland",1],
"services_raw":[
"Exclusieve huur",2,
"Fotoreportage",2,
"Live muziek",1],
"themes_raw":[
"Gemeentehuis",2,
"Strand & Zee",2],
"features_raw":[
"Cafe",3,
"Danszaal",2,
"Tuin",2,
"Strand",1]},
 "facet_dates":{}}}

-- 
View this message in context: http://lucene.472066.n3.nabble.com/Showing-results-based-on-facet-selection-tp1223362p1223362.html
Sent from the Solr - User mailing list archive at Nabble.com.