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 hank williams <ha...@hotmail.com> on 2012/12/21 14:40:58 UTC

facet query

Hi, is there a way with facets to say, return facets that are not 0? I have &facet=true&facet.field=office&facet.field=name as my facet parameters, and with some of my queries it brings back people that have a value of 0.
Thanks 		 	   		  

Re: facet query

Posted by Billy Newman <ne...@gmail.com>.
Again I am interested in hierarchical faceting as explained here:
http://wiki.apache.org/solr/HierarchicalFaceting

Again looking for anyone that has experience with
PathHierarchyTokenizerFactory and Pivot Faceting to help me choose the
'best' solution.

PathHierarchyTokenizerFactory seems to be easy to throw into one field
in solr and have the client pull out info.

Pivot Faceting seems more powerful, but the major drawback that I do
not like is that you need to define a field for each depth in your
hierarchy.  I would like my depth to be more dynamic, i.e. if I need
to store categories a few more levels deep I do not really want to add
more fields (category_4, category_5, etc.....) and then reindex.

Any thoughts or help that anyone can provide would be of great help.  Thanks!

On Tue, Dec 25, 2012 at 10:34 AM, Anirudha Jadhav <an...@nyu.edu> wrote:
> Please see http://wiki.apache.org/solr/SimpleFacetParameters for more
> details
>
> On Friday, December 21, 2012, hank williams wrote:
>
>> Great, thank you.
>>
>> > Date: Fri, 21 Dec 2012 14:42:13 +0100
>> > From: r.kuc@solr.pl <javascript:;>
>> > To: solr-user@lucene.apache.org <javascript:;>
>> > Subject: Re: facet query
>> >
>> > Hello!
>> >
>> > Try facet.mincount=1, that should help.
>> >
>> > --
>> > Regards,
>> >  Rafał Kuć
>> >  Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch -
>> ElasticSearch
>> >
>> > > Hi, is there a way with facets to say, return facets that are not
>> > > 0? I have &facet=true&facet.field=office&facet.field=name as my
>> > > facet parameters, and with some of my queries it brings back people
>> that have a value of 0.
>> > > Thanks
>> >
>>
>
>
>
> --
> Anirudha P. Jadhav

Re: facet query

Posted by Anirudha Jadhav <an...@nyu.edu>.
Please see http://wiki.apache.org/solr/SimpleFacetParameters for more
details

On Friday, December 21, 2012, hank williams wrote:

> Great, thank you.
>
> > Date: Fri, 21 Dec 2012 14:42:13 +0100
> > From: r.kuc@solr.pl <javascript:;>
> > To: solr-user@lucene.apache.org <javascript:;>
> > Subject: Re: facet query
> >
> > Hello!
> >
> > Try facet.mincount=1, that should help.
> >
> > --
> > Regards,
> >  Rafał Kuć
> >  Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch -
> ElasticSearch
> >
> > > Hi, is there a way with facets to say, return facets that are not
> > > 0? I have &facet=true&facet.field=office&facet.field=name as my
> > > facet parameters, and with some of my queries it brings back people
> that have a value of 0.
> > > Thanks
> >
>



-- 
Anirudha P. Jadhav

Re: Exact Search

Posted by Erick Erickson <er...@gmail.com>.
Well, string types are not analyzed at all, so if the town is "Dundee",
this will not match.

If you haven't seen the admin/analysis page, that's the first place I'd
start. Followed by adding &debugQuery=true and looking at the results.

Best
Erick


On Sat, Dec 22, 2012 at 1:04 PM, hank williams <ha...@hotmail.com> wrote:

> Hi,
> I'm trying to build a facet search, but I'm having some difficulties.
> I can do a free text search over things, but I can build exact queries.
> I know that I have a result that has this data
> <doc>    <arr name="label">        <str>iraq treatment of children hong
> kong</str>    </arr>    <arr name="label_long">        <str>iraq treatment
> of children hong kong</str>    </arr>    <arr name="name">
>  <str>cavendish-bentinck, henry</str>        <str>churchill, winston</str>
>        <str>ward, john</str>    </arr>    <arr name="name_long">
>  <str>cavendish-bentinck, henry</str>        <str>churchill, winston</str>
>        <str>ward, john</str>    </arr>    <arr name="town">
>  <str>nottingham south</str>        <str>cabinet</str>
>  <str>department of state</str>        <str>dundee</str>
>  <str>stoke-on-trent stoke</str>    </arr>    <arr name="office">
>  <str />        <str>secretary of state for the colonies</str>        <str
> />    </arr>    <long name="_version_">1422064629033467904</long></doc>
>
> And my schema looks like this
> <field name="id" type="string" indexed="true" stored="true"
> required="true" multiValued="false" /> <field name="name"
> type="text_general" indexed="true" stored="true" multiValued="true"/><field
> name="name_long" type="string" indexed="true" stored="true"
> multiValued="true"/><field name="type" type="string" indexed="true"
> stored="true" multiValued="true"/><field name="label" type="text_general"
> indexed="true" stored="true" multiValued="true"/><field name="label_long"
> type="string" indexed="true" stored="true" multiValued="true"/><field
> name="date" type="date" indexed="true" stored="true"
> multiValued="true"/><field name="town" type="string" indexed="true"
> stored="true" multiValued="true"/><field name="office" type="string"
> indexed="true" stored="true" multiValued="true"/>
> How can I create an exact query with name_long='churchill, winston' AND
> label_long=''iraq treatment of children hong kong' AND town='dundee'
> When I try
> <str name="q">label_long:*iraq treatment of children hong kong* AND
> name_long:*churchill, winston* AND town:*dundee*</str>
> I get zero results.

Exact Search

Posted by hank williams <ha...@hotmail.com>.
Hi,
I'm trying to build a facet search, but I'm having some difficulties. 
I can do a free text search over things, but I can build exact queries.
I know that I have a result that has this data
<doc>    <arr name="label">        <str>iraq treatment of children hong kong</str>    </arr>    <arr name="label_long">        <str>iraq treatment of children hong kong</str>    </arr>    <arr name="name">        <str>cavendish-bentinck, henry</str>        <str>churchill, winston</str>        <str>ward, john</str>    </arr>    <arr name="name_long">        <str>cavendish-bentinck, henry</str>        <str>churchill, winston</str>        <str>ward, john</str>    </arr>    <arr name="town">        <str>nottingham south</str>        <str>cabinet</str>        <str>department of state</str>        <str>dundee</str>        <str>stoke-on-trent stoke</str>    </arr>    <arr name="office">        <str />        <str>secretary of state for the colonies</str>        <str />    </arr>    <long name="_version_">1422064629033467904</long></doc>

And my schema looks like this
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> <field name="name" type="text_general" indexed="true" stored="true" multiValued="true"/><field name="name_long" type="string" indexed="true" stored="true" multiValued="true"/><field name="type" type="string" indexed="true" stored="true" multiValued="true"/><field name="label" type="text_general" indexed="true" stored="true" multiValued="true"/><field name="label_long" type="string" indexed="true" stored="true" multiValued="true"/><field name="date" type="date" indexed="true" stored="true" multiValued="true"/><field name="town" type="string" indexed="true" stored="true" multiValued="true"/><field name="office" type="string" indexed="true" stored="true" multiValued="true"/>
How can I create an exact query with name_long='churchill, winston' AND label_long=''iraq treatment of children hong kong' AND town='dundee'
When I try
<str name="q">label_long:*iraq treatment of children hong kong* AND name_long:*churchill, winston* AND town:*dundee*</str>
I get zero results. 		 	   		  

Re: AND OR query

Posted by Jack Krupansky <ja...@basetechnology.com>.
Put parentheses around the original query and your new contraint and 
separate them with "AND":

    (...) AND (...)

Either of those sub-queries could have any complexity of AND and OR.

Or,

Put the constraint query into a filter query: &fq=... , which will limit the 
query results as specified.

-- Jack Krupansky

-----Original Message----- 
From: hank williams
Sent: Friday, December 21, 2012 6:45 PM
To: solr-user@lucene.apache.org
Subject: AND OR query

If I do a free text search for a keyword over all my fields using the query 
winston churchill
town:*winston churchill* OR label:*winston churchill* OR name:*winston 
churchill* OR office:*winston churchill*
I get plenty of results. But If I want to filter the searches down to towns. 
So Winston Chruchill was in the town of dundee, how can I keep doing a free 
text search over my data but add a mandatory AND?
town:*dundee* OR label:*winston churchill* AND name:*churchill* OR 
office:*winston churchill*
In the example above I want say town must be 'dundee' AND name must contain 
'churchill'; label and office may or may not contain 'winston churchill', 
but from my original free text search I have no idea to know in which field 
'winston churchill' oringated from. By knowing that I want to filter down to 
town, I can't just say town:*dundee* because this is another query and 
'winston churchill' may be a label or may be a name.
Hope this makes sense.
Thanks 


AND OR query

Posted by hank williams <ha...@hotmail.com>.
If I do a free text search for a keyword over all my fields using the query winston churchill
town:*winston churchill* OR label:*winston churchill* OR name:*winston churchill* OR office:*winston churchill*
I get plenty of results. But If I want to filter the searches down to towns. So Winston Chruchill was in the town of dundee, how can I keep doing a free text search over my data but add a mandatory AND?
town:*dundee* OR label:*winston churchill* AND name:*churchill* OR office:*winston churchill*
In the example above I want say town must be 'dundee' AND name must contain 'churchill'; label and office may or may not contain 'winston churchill', but from my original free text search I have no idea to know in which field 'winston churchill' oringated from. By knowing that I want to filter down to town, I can't just say town:*dundee* because this is another query and 'winston churchill' may be a label or may be a name.
Hope this makes sense.
Thanks 		 	   		  

RE: facet query

Posted by hank williams <ha...@hotmail.com>.
Great, thank you.

> Date: Fri, 21 Dec 2012 14:42:13 +0100
> From: r.kuc@solr.pl
> To: solr-user@lucene.apache.org
> Subject: Re: facet query
> 
> Hello!
> 
> Try facet.mincount=1, that should help.
> 
> -- 
> Regards,
>  Rafał Kuć
>  Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch
> 
> > Hi, is there a way with facets to say, return facets that are not
> > 0? I have &facet=true&facet.field=office&facet.field=name as my
> > facet parameters, and with some of my queries it brings back people that have a value of 0.
> > Thanks                                    
> 
 		 	   		  

Re: facet query

Posted by Rafał Kuć <r....@solr.pl>.
Hello!

Try facet.mincount=1, that should help.

-- 
Regards,
 Rafał Kuć
 Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

> Hi, is there a way with facets to say, return facets that are not
> 0? I have &facet=true&facet.field=office&facet.field=name as my
> facet parameters, and with some of my queries it brings back people that have a value of 0.
> Thanks