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 Nalini Kartha <na...@gmail.com> on 2012/12/26 17:21:26 UTC

Converting fq params to Filter object

Hi,

I'm trying to figure out how to convert the fq params that are being passed
to Solr into something that can be used to filter the results of a query
that's being issued against the Lucene IndexSearcher (I'm modifying some
Lucene code to issue the query so calling through to one of the
SolrIndexSearcher methods would be ugly).

Looks like one of the IndexSearcher.search(Query query, Filter filter, ...)
 methods would do what I want but I'm wondering if there's any easy way of
converting the fq params into a Filter? Or is there a better way of doing
all of this?

Thanks,
Nalini

Re: Converting fq params to Filter object

Posted by Nalini Kartha <na...@gmail.com>.
Was digging around some more and I noticed the use of ProcessedFilter in
SolrIndexSearcher.getDocListNC(). Could I first create a ProcessedFilter
from the fq params in the DirectSolrSpellChecker and then pass down the
Lucene Filter object from the ProcessFilter to the DirectSpellChecker for
the correction queries?

Thanks,
Nalini


On Fri, Dec 28, 2012 at 12:09 PM, Nalini Kartha <na...@gmail.com>wrote:

> Hi James,
>
> We're using Solr but reason I wanted to issue the queries from
> DirectSpellChecker was so that we don't end up returning a bunch of
> corrections from suggestSimilar() which then later get weeded out when we
> run the extra correction queries because they would return no hits taking
> fqs into account. If we were able to issue the queries at the time of
> building up the list of corrections then we know that they are all valid.
>
> Thanks for the pointer to the EarlyTerminatingCollector, that seems like
> it would improve perf a lot.
>
> I'm still not sure if there's an easy way to build the Filter object from
> the fq params though, will keep digging around. If someone could point me
> to any code that does this conversion (I'm guessing that conversion needs
> to be done at some point for regular queries when Solr calls into Lucene
> but I could be wrong) that would be much appreciated.
>
> Thanks,
> Nalini
>
>
> On Thu, Dec 27, 2012 at 4:28 PM, Dyer, James <James.Dyer@ingramcontent.com
> > wrote:
>
>> Nalini,
>>
>> Assuming that you're using Solr, the hook into the collate functionality
>> is in SpellCheckComponent#addCollationsToResponse .  To do what you want,
>> you would have to modify the call to SpellCheckCollator to issue test
>> queries against the individual words instead of the collations.
>>
>> See
>> http://svn.apache.org/repos/asf/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
>>
>> Of course if you're using Lucene directly and not Solr, then you would
>> want to build a series of queries that each query one word with the filters
>> applied.  DirectSpellChecker#suggestSimilar returns an array of SuggestWord
>> instances that contain the individual words you would want to try.  To
>> optimize this, you can use the same approach as in SOLR-3240, implementing
>> a Collector that only looks for 1 document then quits.
>>
>> James Dyer
>> E-Commerce Systems
>> Ingram Content Group
>> (615) 213-4311
>>
>>
>> -----Original Message-----
>> From: Nalini Kartha [mailto:nalinikartha@gmail.com]
>> Sent: Thursday, December 27, 2012 2:31 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Converting fq params to Filter object
>>
>> Hi James,
>>
>> Yup, that was what I tried to do initially but it seems like calling
>> through to those Solr methods from DirectSpellChecker was not a good idea
>> -
>> am I wrong? And like you mentioned, this seemed like it wasn't low-level
>> enough.
>>
>> Eric: Unfortunately the collate functionality does not work for our use
>> case since the queries we're correcting are default OR. Here's the
>> original
>> thread about this -
>>
>>
>> http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201212.mbox/%3CCAMqOzYFTgiWyRbvwSdF0hFZ1SZNkQ9gnBJfDb_OBNeLsMvR0XA@mail.gmail.com%3E
>>
>> Thanks,
>> Nalini
>>
>> On Thu, Dec 27, 2012 at 2:46 PM, Dyer, James
>> <Ja...@ingramcontent.com>wrote:
>>
>> > https://issues.apache.org/jira/browse/SOLR-3240
>>
>>
>

Re: Converting fq params to Filter object

Posted by Nalini Kartha <na...@gmail.com>.
Hi James,

We're using Solr but reason I wanted to issue the queries from
DirectSpellChecker was so that we don't end up returning a bunch of
corrections from suggestSimilar() which then later get weeded out when we
run the extra correction queries because they would return no hits taking
fqs into account. If we were able to issue the queries at the time of
building up the list of corrections then we know that they are all valid.

Thanks for the pointer to the EarlyTerminatingCollector, that seems like it
would improve perf a lot.

I'm still not sure if there's an easy way to build the Filter object from
the fq params though, will keep digging around. If someone could point me
to any code that does this conversion (I'm guessing that conversion needs
to be done at some point for regular queries when Solr calls into Lucene
but I could be wrong) that would be much appreciated.

Thanks,
Nalini


On Thu, Dec 27, 2012 at 4:28 PM, Dyer, James
<Ja...@ingramcontent.com>wrote:

> Nalini,
>
> Assuming that you're using Solr, the hook into the collate functionality
> is in SpellCheckComponent#addCollationsToResponse .  To do what you want,
> you would have to modify the call to SpellCheckCollator to issue test
> queries against the individual words instead of the collations.
>
> See
> http://svn.apache.org/repos/asf/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
>
> Of course if you're using Lucene directly and not Solr, then you would
> want to build a series of queries that each query one word with the filters
> applied.  DirectSpellChecker#suggestSimilar returns an array of SuggestWord
> instances that contain the individual words you would want to try.  To
> optimize this, you can use the same approach as in SOLR-3240, implementing
> a Collector that only looks for 1 document then quits.
>
> James Dyer
> E-Commerce Systems
> Ingram Content Group
> (615) 213-4311
>
>
> -----Original Message-----
> From: Nalini Kartha [mailto:nalinikartha@gmail.com]
> Sent: Thursday, December 27, 2012 2:31 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Converting fq params to Filter object
>
> Hi James,
>
> Yup, that was what I tried to do initially but it seems like calling
> through to those Solr methods from DirectSpellChecker was not a good idea -
> am I wrong? And like you mentioned, this seemed like it wasn't low-level
> enough.
>
> Eric: Unfortunately the collate functionality does not work for our use
> case since the queries we're correcting are default OR. Here's the original
> thread about this -
>
>
> http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201212.mbox/%3CCAMqOzYFTgiWyRbvwSdF0hFZ1SZNkQ9gnBJfDb_OBNeLsMvR0XA@mail.gmail.com%3E
>
> Thanks,
> Nalini
>
> On Thu, Dec 27, 2012 at 2:46 PM, Dyer, James
> <Ja...@ingramcontent.com>wrote:
>
> > https://issues.apache.org/jira/browse/SOLR-3240
>
>

RE: Converting fq params to Filter object

Posted by "Dyer, James" <Ja...@ingramcontent.com>.
Nalini,

Assuming that you're using Solr, the hook into the collate functionality is in SpellCheckComponent#addCollationsToResponse .  To do what you want, you would have to modify the call to SpellCheckCollator to issue test queries against the individual words instead of the collations.

See http://svn.apache.org/repos/asf/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java

Of course if you're using Lucene directly and not Solr, then you would want to build a series of queries that each query one word with the filters applied.  DirectSpellChecker#suggestSimilar returns an array of SuggestWord instances that contain the individual words you would want to try.  To optimize this, you can use the same approach as in SOLR-3240, implementing a Collector that only looks for 1 document then quits.

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: Nalini Kartha [mailto:nalinikartha@gmail.com] 
Sent: Thursday, December 27, 2012 2:31 PM
To: solr-user@lucene.apache.org
Subject: Re: Converting fq params to Filter object

Hi James,

Yup, that was what I tried to do initially but it seems like calling
through to those Solr methods from DirectSpellChecker was not a good idea -
am I wrong? And like you mentioned, this seemed like it wasn't low-level
enough.

Eric: Unfortunately the collate functionality does not work for our use
case since the queries we're correcting are default OR. Here's the original
thread about this -

http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201212.mbox/%3CCAMqOzYFTgiWyRbvwSdF0hFZ1SZNkQ9gnBJfDb_OBNeLsMvR0XA@mail.gmail.com%3E

Thanks,
Nalini

On Thu, Dec 27, 2012 at 2:46 PM, Dyer, James
<Ja...@ingramcontent.com>wrote:

> https://issues.apache.org/jira/browse/SOLR-3240


Re: Converting fq params to Filter object

Posted by Nalini Kartha <na...@gmail.com>.
Hi James,

Yup, that was what I tried to do initially but it seems like calling
through to those Solr methods from DirectSpellChecker was not a good idea -
am I wrong? And like you mentioned, this seemed like it wasn't low-level
enough.

Eric: Unfortunately the collate functionality does not work for our use
case since the queries we're correcting are default OR. Here's the original
thread about this -

http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201212.mbox/%3CCAMqOzYFTgiWyRbvwSdF0hFZ1SZNkQ9gnBJfDb_OBNeLsMvR0XA@mail.gmail.com%3E

Thanks,
Nalini

On Thu, Dec 27, 2012 at 2:46 PM, Dyer, James
<Ja...@ingramcontent.com>wrote:

> https://issues.apache.org/jira/browse/SOLR-3240

RE: Converting fq params to Filter object

Posted by "Dyer, James" <Ja...@ingramcontent.com>.
Nalini,

You could take the code from SpellCheckCollator#collate and have it issue a test query for each word individually instead of for each collation.  This would do exactly what you want. See http://svn.apache.org/repos/asf/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java

If you are concerned this isn't low-level enough and that performance would suffer, then see https://issues.apache.org/jira/browse/SOLR-3240 , which has a patch that uses a collector that quits after finding one document.  This makes each test query faster at the expense of not getting exact hit-counts.

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: Nalini Kartha [mailto:nalinikartha@gmail.com] 
Sent: Thursday, December 27, 2012 1:09 PM
To: solr-user@lucene.apache.org
Subject: Re: Converting fq params to Filter object

Hi Eric,

Sorry, I think I wasn't very clear in explaining what we need to do.

We don't really need to do any complicated overriding, just want to change
the DirectSpellChecker to issue a query for every correction it finds *with
fq params from the original query taken into account* so that we can check
if the correction would actually result in some hits.

I was thinking of implementing this using the IndexSearcher.search(Query
query, Filter filter, int n) method where 'query' is a regular TermQuery
(the term is the correction) and 'filter' would represent the fq params.
What I'm not sure about is how to convert the fq params from Solr into a
Filter object and whether this is something we need to build ourselves or
if there's an existing API for this.

Also, I'm new to this code so not sure if I'm approaching this the wrong
way. Any advice/pointers are much appreciated.

Thanks,
Nalini



On Thu, Dec 27, 2012 at 12:53 PM, Erik Hatcher <er...@gmail.com>wrote:

> I think the answer is yes, that there's a better way to doing all of this.
>  But I'm not yet sure what this all entails in your situation.  What are
> you overriding with the Lucene searches?   I imagine Solr has the
> flexibility to handle what you're trying to do without overriding anything
> core in SolrIndexSearcher.
>
> Generally, the way to get a custom filter in place is to create a custom
> query parser and use that for your fq parameter, like fq={!myparser
> param1='some value'}possible+expression+if+needed, so maybe that helps?
>
> Tell us more about what you're doing specifically, and maybe we can guide
> you to a more elegant way to plug in any custom logic you want.
>
>         Erik
>
> On Dec 26, 2012, at 11:21 , Nalini Kartha wrote:
>
> > Hi,
> >
> > I'm trying to figure out how to convert the fq params that are being
> passed
> > to Solr into something that can be used to filter the results of a query
> > that's being issued against the Lucene IndexSearcher (I'm modifying some
> > Lucene code to issue the query so calling through to one of the
> > SolrIndexSearcher methods would be ugly).
> >
> > Looks like one of the IndexSearcher.search(Query query, Filter filter,
> ...)
> > methods would do what I want but I'm wondering if there's any easy way of
> > converting the fq params into a Filter? Or is there a better way of doing
> > all of this?
> >
> > Thanks,
> > Nalini
>
>


Re: Converting fq params to Filter object

Posted by Erik Hatcher <er...@gmail.com>.
Apologies for misunderstanding.  

Does what you're trying to do already work this way using the <http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.maxCollationTries> maxCollationTries feature of the spellcheck component?

It looks like it passes through the fq's even, so that the hit count that the extended results is inclusive of the filters.

Maybe I'm missing something though, sorry.

	Erik

On Dec 27, 2012, at 14:09 , Nalini Kartha wrote:

> Hi Eric,
> 
> Sorry, I think I wasn't very clear in explaining what we need to do.
> 
> We don't really need to do any complicated overriding, just want to change
> the DirectSpellChecker to issue a query for every correction it finds *with
> fq params from the original query taken into account* so that we can check
> if the correction would actually result in some hits.
> 
> I was thinking of implementing this using the IndexSearcher.search(Query
> query, Filter filter, int n) method where 'query' is a regular TermQuery
> (the term is the correction) and 'filter' would represent the fq params.
> What I'm not sure about is how to convert the fq params from Solr into a
> Filter object and whether this is something we need to build ourselves or
> if there's an existing API for this.
> 
> Also, I'm new to this code so not sure if I'm approaching this the wrong
> way. Any advice/pointers are much appreciated.
> 
> Thanks,
> Nalini
> 
> 
> 
> On Thu, Dec 27, 2012 at 12:53 PM, Erik Hatcher <er...@gmail.com>wrote:
> 
>> I think the answer is yes, that there's a better way to doing all of this.
>> But I'm not yet sure what this all entails in your situation.  What are
>> you overriding with the Lucene searches?   I imagine Solr has the
>> flexibility to handle what you're trying to do without overriding anything
>> core in SolrIndexSearcher.
>> 
>> Generally, the way to get a custom filter in place is to create a custom
>> query parser and use that for your fq parameter, like fq={!myparser
>> param1='some value'}possible+expression+if+needed, so maybe that helps?
>> 
>> Tell us more about what you're doing specifically, and maybe we can guide
>> you to a more elegant way to plug in any custom logic you want.
>> 
>>        Erik
>> 
>> On Dec 26, 2012, at 11:21 , Nalini Kartha wrote:
>> 
>>> Hi,
>>> 
>>> I'm trying to figure out how to convert the fq params that are being
>> passed
>>> to Solr into something that can be used to filter the results of a query
>>> that's being issued against the Lucene IndexSearcher (I'm modifying some
>>> Lucene code to issue the query so calling through to one of the
>>> SolrIndexSearcher methods would be ugly).
>>> 
>>> Looks like one of the IndexSearcher.search(Query query, Filter filter,
>> ...)
>>> methods would do what I want but I'm wondering if there's any easy way of
>>> converting the fq params into a Filter? Or is there a better way of doing
>>> all of this?
>>> 
>>> Thanks,
>>> Nalini
>> 
>> 


Re: Converting fq params to Filter object

Posted by Nalini Kartha <na...@gmail.com>.
Hi Eric,

Sorry, I think I wasn't very clear in explaining what we need to do.

We don't really need to do any complicated overriding, just want to change
the DirectSpellChecker to issue a query for every correction it finds *with
fq params from the original query taken into account* so that we can check
if the correction would actually result in some hits.

I was thinking of implementing this using the IndexSearcher.search(Query
query, Filter filter, int n) method where 'query' is a regular TermQuery
(the term is the correction) and 'filter' would represent the fq params.
What I'm not sure about is how to convert the fq params from Solr into a
Filter object and whether this is something we need to build ourselves or
if there's an existing API for this.

Also, I'm new to this code so not sure if I'm approaching this the wrong
way. Any advice/pointers are much appreciated.

Thanks,
Nalini



On Thu, Dec 27, 2012 at 12:53 PM, Erik Hatcher <er...@gmail.com>wrote:

> I think the answer is yes, that there's a better way to doing all of this.
>  But I'm not yet sure what this all entails in your situation.  What are
> you overriding with the Lucene searches?   I imagine Solr has the
> flexibility to handle what you're trying to do without overriding anything
> core in SolrIndexSearcher.
>
> Generally, the way to get a custom filter in place is to create a custom
> query parser and use that for your fq parameter, like fq={!myparser
> param1='some value'}possible+expression+if+needed, so maybe that helps?
>
> Tell us more about what you're doing specifically, and maybe we can guide
> you to a more elegant way to plug in any custom logic you want.
>
>         Erik
>
> On Dec 26, 2012, at 11:21 , Nalini Kartha wrote:
>
> > Hi,
> >
> > I'm trying to figure out how to convert the fq params that are being
> passed
> > to Solr into something that can be used to filter the results of a query
> > that's being issued against the Lucene IndexSearcher (I'm modifying some
> > Lucene code to issue the query so calling through to one of the
> > SolrIndexSearcher methods would be ugly).
> >
> > Looks like one of the IndexSearcher.search(Query query, Filter filter,
> ...)
> > methods would do what I want but I'm wondering if there's any easy way of
> > converting the fq params into a Filter? Or is there a better way of doing
> > all of this?
> >
> > Thanks,
> > Nalini
>
>

Re: Converting fq params to Filter object

Posted by Erik Hatcher <er...@gmail.com>.
I think the answer is yes, that there's a better way to doing all of this.  But I'm not yet sure what this all entails in your situation.  What are you overriding with the Lucene searches?   I imagine Solr has the flexibility to handle what you're trying to do without overriding anything core in SolrIndexSearcher.

Generally, the way to get a custom filter in place is to create a custom query parser and use that for your fq parameter, like fq={!myparser param1='some value'}possible+expression+if+needed, so maybe that helps?

Tell us more about what you're doing specifically, and maybe we can guide you to a more elegant way to plug in any custom logic you want.

	Erik

On Dec 26, 2012, at 11:21 , Nalini Kartha wrote:

> Hi,
> 
> I'm trying to figure out how to convert the fq params that are being passed
> to Solr into something that can be used to filter the results of a query
> that's being issued against the Lucene IndexSearcher (I'm modifying some
> Lucene code to issue the query so calling through to one of the
> SolrIndexSearcher methods would be ugly).
> 
> Looks like one of the IndexSearcher.search(Query query, Filter filter, ...)
> methods would do what I want but I'm wondering if there's any easy way of
> converting the fq params into a Filter? Or is there a better way of doing
> all of this?
> 
> Thanks,
> Nalini


Re: Converting fq params to Filter object

Posted by Nalini Kartha <na...@gmail.com>.
Hi Lance,

Thanks for the response.

I didn't quite understand how to issue the queries from DirectSpellChecker
with the fq params applied like you were suggesting - could you point me to
the API that can be used for this?

Also, we haven't benchmarked the DirectSpellChecker against the
IndexBasedSpellChecker.

I considered issuing one large OR query with all corrections but that
doesn't ensure that *every* correction would return some hits with the fq
params applied, it only tells us that some correction returned hits so this
isn't restrictive enough for us. And ANDing the corrections together
becomes too restrictive since it requires that *all* corrections existed in
the same documents instead of checking that they individually exist in some
docs (which satisfy the filter queries of course).

Thanks,
Nalini


On Wed, Dec 26, 2012 at 9:32 PM, Lance Norskog <go...@gmail.com> wrote:

> A Solr facet query does a boolean query, caches the Lucene facet data
> structure, and uses it as a Lucene filter. After that until you do a full
> commit, using the same fq=string (you must match the string exactly)
> fetches the cached data structure and uses it again as a Lucene filter.
>
> Have you benchmarked the DirectSpellChecker against
> IndexBasedSpellChecker? If you use the fq= filter query as the
> spellcheck.q= query it should use the cached filter.
>
> Also, since you are checking all words against the same filter query, can
> you just do one large OR query with all of the words?
>
>
> On 12/26/2012 03:10 PM, Nalini Kartha wrote:
>
>> Hi Otis,
>>
>> Sorry, let me be more specific.
>>
>> The end goal is for the DirectSpellChecker to make sure that the
>> corrections it is returning will return some results taking into account
>> the fq params included in the original query. This is a follow up question
>> to another question I had posted earlier -
>>
>> http://mail-archives.apache.**org/mod_mbox/lucene-solr-user/**
>> 201212.mbox/%**3CCAMqOzYFTgiWyRbvwSdF0hFZ1SZN**
>> kQ9gnBJfDb_OBNeLsMvR0XA@mail.**gmail.com%3E<http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201212.mbox/%3CCAMqOzYFTgiWyRbvwSdF0hFZ1SZNkQ9gnBJfDb_OBNeLsMvR0XA@mail.gmail.com%3E>
>>
>> Initially, the way I was thinking of implementing this was to call one of
>> the SolrIndexSearcher.getDocSet() methods for ever correction, passing in
>> the correction as the Query and a DocSet created from the fq queries. But
>> I
>> didn't think that calling a SolrIndexSearcher method in Lucene code
>> (DirectSpellChecker) was a good idea. So I started looking at which method
>> on IndexSearcher would accomplish this. That's where I'm stuck trying to
>> figure out how to convert the fq params into a Filter object.
>>
>> Does this approach make sense? Also I realize that this implementation is
>> probably non-performant but wanted to give it a try and measure how it
>> does. Any advice about what the perf overhead from issuing such queries
>> for
>> say 50 corrections would be? Note that the filter from the fq params is
>> the
>> same for every query - would that be cached and help speed things up?
>>
>> Thanks,
>> Nalini
>>
>>
>> On Wed, Dec 26, 2012 at 3:34 PM, Otis Gospodnetic <
>> otis.gospodnetic@gmail.com> wrote:
>>
>>  Hi,
>>>
>>> The fq *is* for filtering.
>>>
>>> What is your end goal, what are you trying to achieve?
>>>
>>> Otis
>>> Solr & ElasticSearch Support
>>> http://sematext.com/
>>> On Dec 26, 2012 11:22 AM, "Nalini Kartha" <na...@gmail.com>
>>> wrote:
>>>
>>>  Hi,
>>>>
>>>> I'm trying to figure out how to convert the fq params that are being
>>>>
>>> passed
>>>
>>>> to Solr into something that can be used to filter the results of a query
>>>> that's being issued against the Lucene IndexSearcher (I'm modifying some
>>>> Lucene code to issue the query so calling through to one of the
>>>> SolrIndexSearcher methods would be ugly).
>>>>
>>>> Looks like one of the IndexSearcher.search(Query query, Filter filter,
>>>>
>>> ...)
>>>
>>>>   methods would do what I want but I'm wondering if there's any easy way
>>>>
>>> of
>>>
>>>> converting the fq params into a Filter? Or is there a better way of
>>>> doing
>>>> all of this?
>>>>
>>>> Thanks,
>>>> Nalini
>>>>
>>>>
>

Re: Converting fq params to Filter object

Posted by Lance Norskog <go...@gmail.com>.
A Solr facet query does a boolean query, caches the Lucene facet data 
structure, and uses it as a Lucene filter. After that until you do a 
full commit, using the same fq=string (you must match the string 
exactly) fetches the cached data structure and uses it again as a Lucene 
filter.

Have you benchmarked the DirectSpellChecker against 
IndexBasedSpellChecker? If you use the fq= filter query as the 
spellcheck.q= query it should use the cached filter.

Also, since you are checking all words against the same filter query, 
can you just do one large OR query with all of the words?

On 12/26/2012 03:10 PM, Nalini Kartha wrote:
> Hi Otis,
>
> Sorry, let me be more specific.
>
> The end goal is for the DirectSpellChecker to make sure that the
> corrections it is returning will return some results taking into account
> the fq params included in the original query. This is a follow up question
> to another question I had posted earlier -
>
> http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201212.mbox/%3CCAMqOzYFTgiWyRbvwSdF0hFZ1SZNkQ9gnBJfDb_OBNeLsMvR0XA@mail.gmail.com%3E
>
> Initially, the way I was thinking of implementing this was to call one of
> the SolrIndexSearcher.getDocSet() methods for ever correction, passing in
> the correction as the Query and a DocSet created from the fq queries. But I
> didn't think that calling a SolrIndexSearcher method in Lucene code
> (DirectSpellChecker) was a good idea. So I started looking at which method
> on IndexSearcher would accomplish this. That's where I'm stuck trying to
> figure out how to convert the fq params into a Filter object.
>
> Does this approach make sense? Also I realize that this implementation is
> probably non-performant but wanted to give it a try and measure how it
> does. Any advice about what the perf overhead from issuing such queries for
> say 50 corrections would be? Note that the filter from the fq params is the
> same for every query - would that be cached and help speed things up?
>
> Thanks,
> Nalini
>
>
> On Wed, Dec 26, 2012 at 3:34 PM, Otis Gospodnetic <
> otis.gospodnetic@gmail.com> wrote:
>
>> Hi,
>>
>> The fq *is* for filtering.
>>
>> What is your end goal, what are you trying to achieve?
>>
>> Otis
>> Solr & ElasticSearch Support
>> http://sematext.com/
>> On Dec 26, 2012 11:22 AM, "Nalini Kartha" <na...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I'm trying to figure out how to convert the fq params that are being
>> passed
>>> to Solr into something that can be used to filter the results of a query
>>> that's being issued against the Lucene IndexSearcher (I'm modifying some
>>> Lucene code to issue the query so calling through to one of the
>>> SolrIndexSearcher methods would be ugly).
>>>
>>> Looks like one of the IndexSearcher.search(Query query, Filter filter,
>> ...)
>>>   methods would do what I want but I'm wondering if there's any easy way
>> of
>>> converting the fq params into a Filter? Or is there a better way of doing
>>> all of this?
>>>
>>> Thanks,
>>> Nalini
>>>


Re: Converting fq params to Filter object

Posted by Nalini Kartha <na...@gmail.com>.
Hi Otis,

Sorry, let me be more specific.

The end goal is for the DirectSpellChecker to make sure that the
corrections it is returning will return some results taking into account
the fq params included in the original query. This is a follow up question
to another question I had posted earlier -

http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201212.mbox/%3CCAMqOzYFTgiWyRbvwSdF0hFZ1SZNkQ9gnBJfDb_OBNeLsMvR0XA@mail.gmail.com%3E

Initially, the way I was thinking of implementing this was to call one of
the SolrIndexSearcher.getDocSet() methods for ever correction, passing in
the correction as the Query and a DocSet created from the fq queries. But I
didn't think that calling a SolrIndexSearcher method in Lucene code
(DirectSpellChecker) was a good idea. So I started looking at which method
on IndexSearcher would accomplish this. That's where I'm stuck trying to
figure out how to convert the fq params into a Filter object.

Does this approach make sense? Also I realize that this implementation is
probably non-performant but wanted to give it a try and measure how it
does. Any advice about what the perf overhead from issuing such queries for
say 50 corrections would be? Note that the filter from the fq params is the
same for every query - would that be cached and help speed things up?

Thanks,
Nalini


On Wed, Dec 26, 2012 at 3:34 PM, Otis Gospodnetic <
otis.gospodnetic@gmail.com> wrote:

> Hi,
>
> The fq *is* for filtering.
>
> What is your end goal, what are you trying to achieve?
>
> Otis
> Solr & ElasticSearch Support
> http://sematext.com/
> On Dec 26, 2012 11:22 AM, "Nalini Kartha" <na...@gmail.com> wrote:
>
> > Hi,
> >
> > I'm trying to figure out how to convert the fq params that are being
> passed
> > to Solr into something that can be used to filter the results of a query
> > that's being issued against the Lucene IndexSearcher (I'm modifying some
> > Lucene code to issue the query so calling through to one of the
> > SolrIndexSearcher methods would be ugly).
> >
> > Looks like one of the IndexSearcher.search(Query query, Filter filter,
> ...)
> >  methods would do what I want but I'm wondering if there's any easy way
> of
> > converting the fq params into a Filter? Or is there a better way of doing
> > all of this?
> >
> > Thanks,
> > Nalini
> >
>

Re: Converting fq params to Filter object

Posted by Otis Gospodnetic <ot...@gmail.com>.
Hi,

The fq *is* for filtering.

What is your end goal, what are you trying to achieve?

Otis
Solr & ElasticSearch Support
http://sematext.com/
On Dec 26, 2012 11:22 AM, "Nalini Kartha" <na...@gmail.com> wrote:

> Hi,
>
> I'm trying to figure out how to convert the fq params that are being passed
> to Solr into something that can be used to filter the results of a query
> that's being issued against the Lucene IndexSearcher (I'm modifying some
> Lucene code to issue the query so calling through to one of the
> SolrIndexSearcher methods would be ugly).
>
> Looks like one of the IndexSearcher.search(Query query, Filter filter, ...)
>  methods would do what I want but I'm wondering if there's any easy way of
> converting the fq params into a Filter? Or is there a better way of doing
> all of this?
>
> Thanks,
> Nalini
>