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 Hakim Benoudjit <h....@gmail.com> on 2014/02/26 16:50:46 UTC

Format of the spellcheck.q used to get suggestions in current filter

I have some difficulties to use `spellcheck.q` to get only suggestions for
current query.

When I set `spellcheck.q` to lucene query format (field1:value1 AND
field2:value2), it doesnt return me any result.

I have supposed that the value stored in `spellcheck.q` is just the value
of ``spellcheck` component default field, but it returns an error in this
case.

Any help please?

Re: Format of the spellcheck.q used to get suggestions in current filter

Posted by Jack Krupansky <ja...@basetechnology.com>.
Could you post the request URL and the XML/JSON Solr response? And the 
solrconfig for both the query request handler and the spellcheck component.

Is your spell check component configured for both fields, field1 and field2?

-- Jack Krupansky

-----Original Message----- 
From: Hakim Benoudjit
Sent: Wednesday, February 26, 2014 10:50 AM
To: solr-user@lucene.apache.org
Subject: Format of the spellcheck.q used to get suggestions in current 
filter

I have some difficulties to use `spellcheck.q` to get only suggestions for
current query.

When I set `spellcheck.q` to lucene query format (field1:value1 AND
field2:value2), it doesnt return me any result.

I have supposed that the value stored in `spellcheck.q` is just the value
of ``spellcheck` component default field, but it returns an error in this
case.

Any help please? 


Re: Format of the spellcheck.q used to get suggestions in current filter

Posted by Hakim Benoudjit <h....@gmail.com>.
I'm afraid I have to manually retreive all docs for suggested query in
current filter (category:Cars&q=Renau) and count them to get the frequency
in given filter.


2014-02-26 19:09 GMT+01:00 Hakim Benoudjit <h....@gmail.com>:

> It seems that suggestion frequency stays the same with filter query (fq).
>
>
> 2014-02-26 19:05 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:
>
>
>>
>> Just a guess, what happens when you use filter query?
>> fq=category:Cars&q=Renau
>>
>>
>>
>> On Wednesday, February 26, 2014 7:38 PM, Hakim Benoudjit <
>> h.benoudjit@gmail.com> wrote:
>> I mean that: I want suggestions frequency to count only document in
>> current
>> query (solr 'q'). My issue is even if suggestion 'word' is correct; the
>> frequency is relative to all index and not only to the current query.
>> Suppose that I have 'q = category:Cars', in this case, if my searched
>> query
>> is 'Renau' (for cars model), suggestions frequence should only count cars
>> having the name 'Renault', not persons....
>>
>>
>>
>> 2014-02-26 18:07 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:
>>
>> > Hi,
>> >
>> > What do you mean by "suggestions only for current category" ? Do you
>> mean
>> > that suggested word(s) should return non-zero hits for that category?
>> >
>> > Ahmet
>> >
>> >
>> >
>> > On Wednesday, February 26, 2014 6:36 PM, Hakim Benoudjit <
>> > h.benoudjit@gmail.com> wrote:
>> > @Jack Krupansky, here is the important portion of my solrconfig.xml:
>> >
>> > <lst name="spellchecker">
>> >   <str name="name">default</str>
>> >   <str name="field">title</str>
>> >   <str name="classname">solr.DirectSolrSpellChecker</str>
>> >   <!-- the spellcheck distance measure used, the default is the internal
>> > levenshtein -->
>> >   <str name="distanceMeasure">internal</str>
>> >   <!-- minimum accuracy needed to be considered a valid spellcheck
>> > suggestion -->
>> >   <float name="accuracy">0.5</float>
>> >   <!-- the maximum #edits we consider when enumerating terms: can be 1
>> or 2
>> > -->
>> >   <int name="maxEdits">2</int>
>> >   <!-- the minimum shared prefix when enumerating terms -->
>> >   <int name="minPrefix">1</int>
>> >   <!-- maximum number of inspections per result. -->
>> >   <int name="maxInspections">5</int>
>> >   <!-- minimum length of a query term to be considered for correction
>> -->
>> >   <int name="minQueryLength">4</int>
>> >   <!-- maximum threshold of documents a query term can appear to be
>> > considered for correction -->
>> >   <float name="maxQueryFrequency">0.01</float>
>> >   <!-- uncomment this to require suggestions to occur in 1% of the
>> > documents
>> >     <float name="thresholdTokenFrequency">.01</float>
>> >   -->
>> > </lst>
>> >
>> > As you guess 'title' field is the one I'm searching & the one I'm
>> building
>> > my suggestions from.
>> >
>> > @Ahmet Arsian: I understand that `spellcheck.q` doesnt resolve my
>> issues,
>> > cause I want to get suggestions only for current category.
>> >
>> >
>> >
>> > 2014-02-26 17:07 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:
>> >
>> > > Hi Hakim,
>> > >
>> > > According to wiki spellcheck.q is intended to use with 'spelling
>> ready'
>> > > query/input.
>> > > 'spelling ready' means it does not contain field names, AND, OR, etc.
>> > > Something like should work. spellcheck.q=value1
>> value2&q=+field1:value1
>> > > +field2:value2
>> > >
>> > > Ahmet
>> > >
>> > >
>> > > On Wednesday, February 26, 2014 5:51 PM, Hakim Benoudjit <
>> > > h.benoudjit@gmail.com> wrote:
>> > > I have some difficulties to use `spellcheck.q` to get only suggestions
>> > for
>> > > current query.
>> > >
>> > > When I set `spellcheck.q` to lucene query format (field1:value1 AND
>> > > field2:value2), it doesnt return me any result.
>> > >
>> > > I have supposed that the value stored in `spellcheck.q` is just the
>> value
>> > > of ``spellcheck` component default field, but it returns an error in
>> this
>> > > case.
>> > >
>> > > Any help please?
>> > >
>> > >
>> >
>> >
>>
>>
>

Re: Format of the spellcheck.q used to get suggestions in current filter

Posted by Hakim Benoudjit <h....@gmail.com>.
It seems that suggestion frequency stays the same with filter query (fq).


2014-02-26 19:05 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:

>
>
> Just a guess, what happens when you use filter query?
> fq=category:Cars&q=Renau
>
>
>
> On Wednesday, February 26, 2014 7:38 PM, Hakim Benoudjit <
> h.benoudjit@gmail.com> wrote:
> I mean that: I want suggestions frequency to count only document in current
> query (solr 'q'). My issue is even if suggestion 'word' is correct; the
> frequency is relative to all index and not only to the current query.
> Suppose that I have 'q = category:Cars', in this case, if my searched query
> is 'Renau' (for cars model), suggestions frequence should only count cars
> having the name 'Renault', not persons....
>
>
>
> 2014-02-26 18:07 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:
>
> > Hi,
> >
> > What do you mean by "suggestions only for current category" ? Do you mean
> > that suggested word(s) should return non-zero hits for that category?
> >
> > Ahmet
> >
> >
> >
> > On Wednesday, February 26, 2014 6:36 PM, Hakim Benoudjit <
> > h.benoudjit@gmail.com> wrote:
> > @Jack Krupansky, here is the important portion of my solrconfig.xml:
> >
> > <lst name="spellchecker">
> >   <str name="name">default</str>
> >   <str name="field">title</str>
> >   <str name="classname">solr.DirectSolrSpellChecker</str>
> >   <!-- the spellcheck distance measure used, the default is the internal
> > levenshtein -->
> >   <str name="distanceMeasure">internal</str>
> >   <!-- minimum accuracy needed to be considered a valid spellcheck
> > suggestion -->
> >   <float name="accuracy">0.5</float>
> >   <!-- the maximum #edits we consider when enumerating terms: can be 1
> or 2
> > -->
> >   <int name="maxEdits">2</int>
> >   <!-- the minimum shared prefix when enumerating terms -->
> >   <int name="minPrefix">1</int>
> >   <!-- maximum number of inspections per result. -->
> >   <int name="maxInspections">5</int>
> >   <!-- minimum length of a query term to be considered for correction -->
> >   <int name="minQueryLength">4</int>
> >   <!-- maximum threshold of documents a query term can appear to be
> > considered for correction -->
> >   <float name="maxQueryFrequency">0.01</float>
> >   <!-- uncomment this to require suggestions to occur in 1% of the
> > documents
> >     <float name="thresholdTokenFrequency">.01</float>
> >   -->
> > </lst>
> >
> > As you guess 'title' field is the one I'm searching & the one I'm
> building
> > my suggestions from.
> >
> > @Ahmet Arsian: I understand that `spellcheck.q` doesnt resolve my issues,
> > cause I want to get suggestions only for current category.
> >
> >
> >
> > 2014-02-26 17:07 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:
> >
> > > Hi Hakim,
> > >
> > > According to wiki spellcheck.q is intended to use with 'spelling ready'
> > > query/input.
> > > 'spelling ready' means it does not contain field names, AND, OR, etc.
> > > Something like should work. spellcheck.q=value1 value2&q=+field1:value1
> > > +field2:value2
> > >
> > > Ahmet
> > >
> > >
> > > On Wednesday, February 26, 2014 5:51 PM, Hakim Benoudjit <
> > > h.benoudjit@gmail.com> wrote:
> > > I have some difficulties to use `spellcheck.q` to get only suggestions
> > for
> > > current query.
> > >
> > > When I set `spellcheck.q` to lucene query format (field1:value1 AND
> > > field2:value2), it doesnt return me any result.
> > >
> > > I have supposed that the value stored in `spellcheck.q` is just the
> value
> > > of ``spellcheck` component default field, but it returns an error in
> this
> > > case.
> > >
> > > Any help please?
> > >
> > >
> >
> >
>
>

Re: Format of the spellcheck.q used to get suggestions in current filter

Posted by Ahmet Arslan <io...@yahoo.com>.

Just a guess, what happens when you use filter query? fq=category:Cars&q=Renau



On Wednesday, February 26, 2014 7:38 PM, Hakim Benoudjit <h....@gmail.com> wrote:
I mean that: I want suggestions frequency to count only document in current
query (solr 'q'). My issue is even if suggestion 'word' is correct; the
frequency is relative to all index and not only to the current query.
Suppose that I have 'q = category:Cars', in this case, if my searched query
is 'Renau' (for cars model), suggestions frequence should only count cars
having the name 'Renault', not persons....



2014-02-26 18:07 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:

> Hi,
>
> What do you mean by "suggestions only for current category" ? Do you mean
> that suggested word(s) should return non-zero hits for that category?
>
> Ahmet
>
>
>
> On Wednesday, February 26, 2014 6:36 PM, Hakim Benoudjit <
> h.benoudjit@gmail.com> wrote:
> @Jack Krupansky, here is the important portion of my solrconfig.xml:
>
> <lst name="spellchecker">
>   <str name="name">default</str>
>   <str name="field">title</str>
>   <str name="classname">solr.DirectSolrSpellChecker</str>
>   <!-- the spellcheck distance measure used, the default is the internal
> levenshtein -->
>   <str name="distanceMeasure">internal</str>
>   <!-- minimum accuracy needed to be considered a valid spellcheck
> suggestion -->
>   <float name="accuracy">0.5</float>
>   <!-- the maximum #edits we consider when enumerating terms: can be 1 or 2
> -->
>   <int name="maxEdits">2</int>
>   <!-- the minimum shared prefix when enumerating terms -->
>   <int name="minPrefix">1</int>
>   <!-- maximum number of inspections per result. -->
>   <int name="maxInspections">5</int>
>   <!-- minimum length of a query term to be considered for correction -->
>   <int name="minQueryLength">4</int>
>   <!-- maximum threshold of documents a query term can appear to be
> considered for correction -->
>   <float name="maxQueryFrequency">0.01</float>
>   <!-- uncomment this to require suggestions to occur in 1% of the
> documents
>     <float name="thresholdTokenFrequency">.01</float>
>   -->
> </lst>
>
> As you guess 'title' field is the one I'm searching & the one I'm building
> my suggestions from.
>
> @Ahmet Arsian: I understand that `spellcheck.q` doesnt resolve my issues,
> cause I want to get suggestions only for current category.
>
>
>
> 2014-02-26 17:07 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:
>
> > Hi Hakim,
> >
> > According to wiki spellcheck.q is intended to use with 'spelling ready'
> > query/input.
> > 'spelling ready' means it does not contain field names, AND, OR, etc.
> > Something like should work. spellcheck.q=value1 value2&q=+field1:value1
> > +field2:value2
> >
> > Ahmet
> >
> >
> > On Wednesday, February 26, 2014 5:51 PM, Hakim Benoudjit <
> > h.benoudjit@gmail.com> wrote:
> > I have some difficulties to use `spellcheck.q` to get only suggestions
> for
> > current query.
> >
> > When I set `spellcheck.q` to lucene query format (field1:value1 AND
> > field2:value2), it doesnt return me any result.
> >
> > I have supposed that the value stored in `spellcheck.q` is just the value
> > of ``spellcheck` component default field, but it returns an error in this
> > case.
> >
> > Any help please?
> >
> >
>
>


Re: Format of the spellcheck.q used to get suggestions in current filter

Posted by Hakim Benoudjit <h....@gmail.com>.
I mean that: I want suggestions frequency to count only document in current
query (solr 'q'). My issue is even if suggestion 'word' is correct; the
frequency is relative to all index and not only to the current query.
Suppose that I have 'q = category:Cars', in this case, if my searched query
is 'Renau' (for cars model), suggestions frequence should only count cars
having the name 'Renault', not persons....


2014-02-26 18:07 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:

> Hi,
>
> What do you mean by "suggestions only for current category" ? Do you mean
> that suggested word(s) should return non-zero hits for that category?
>
> Ahmet
>
>
>
> On Wednesday, February 26, 2014 6:36 PM, Hakim Benoudjit <
> h.benoudjit@gmail.com> wrote:
> @Jack Krupansky, here is the important portion of my solrconfig.xml:
>
> <lst name="spellchecker">
>   <str name="name">default</str>
>   <str name="field">title</str>
>   <str name="classname">solr.DirectSolrSpellChecker</str>
>   <!-- the spellcheck distance measure used, the default is the internal
> levenshtein -->
>   <str name="distanceMeasure">internal</str>
>   <!-- minimum accuracy needed to be considered a valid spellcheck
> suggestion -->
>   <float name="accuracy">0.5</float>
>   <!-- the maximum #edits we consider when enumerating terms: can be 1 or 2
> -->
>   <int name="maxEdits">2</int>
>   <!-- the minimum shared prefix when enumerating terms -->
>   <int name="minPrefix">1</int>
>   <!-- maximum number of inspections per result. -->
>   <int name="maxInspections">5</int>
>   <!-- minimum length of a query term to be considered for correction -->
>   <int name="minQueryLength">4</int>
>   <!-- maximum threshold of documents a query term can appear to be
> considered for correction -->
>   <float name="maxQueryFrequency">0.01</float>
>   <!-- uncomment this to require suggestions to occur in 1% of the
> documents
>     <float name="thresholdTokenFrequency">.01</float>
>   -->
> </lst>
>
> As you guess 'title' field is the one I'm searching & the one I'm building
> my suggestions from.
>
> @Ahmet Arsian: I understand that `spellcheck.q` doesnt resolve my issues,
> cause I want to get suggestions only for current category.
>
>
>
> 2014-02-26 17:07 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:
>
> > Hi Hakim,
> >
> > According to wiki spellcheck.q is intended to use with 'spelling ready'
> > query/input.
> > 'spelling ready' means it does not contain field names, AND, OR, etc.
> > Something like should work. spellcheck.q=value1 value2&q=+field1:value1
> > +field2:value2
> >
> > Ahmet
> >
> >
> > On Wednesday, February 26, 2014 5:51 PM, Hakim Benoudjit <
> > h.benoudjit@gmail.com> wrote:
> > I have some difficulties to use `spellcheck.q` to get only suggestions
> for
> > current query.
> >
> > When I set `spellcheck.q` to lucene query format (field1:value1 AND
> > field2:value2), it doesnt return me any result.
> >
> > I have supposed that the value stored in `spellcheck.q` is just the value
> > of ``spellcheck` component default field, but it returns an error in this
> > case.
> >
> > Any help please?
> >
> >
>
>

Re: Format of the spellcheck.q used to get suggestions in current filter

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi,

What do you mean by "suggestions only for current category" ? Do you mean that suggested word(s) should return non-zero hits for that category?

Ahmet



On Wednesday, February 26, 2014 6:36 PM, Hakim Benoudjit <h....@gmail.com> wrote:
@Jack Krupansky, here is the important portion of my solrconfig.xml:

<lst name="spellchecker">
  <str name="name">default</str>
  <str name="field">title</str>
  <str name="classname">solr.DirectSolrSpellChecker</str>
  <!-- the spellcheck distance measure used, the default is the internal
levenshtein -->
  <str name="distanceMeasure">internal</str>
  <!-- minimum accuracy needed to be considered a valid spellcheck
suggestion -->
  <float name="accuracy">0.5</float>
  <!-- the maximum #edits we consider when enumerating terms: can be 1 or 2
-->
  <int name="maxEdits">2</int>
  <!-- the minimum shared prefix when enumerating terms -->
  <int name="minPrefix">1</int>
  <!-- maximum number of inspections per result. -->
  <int name="maxInspections">5</int>
  <!-- minimum length of a query term to be considered for correction -->
  <int name="minQueryLength">4</int>
  <!-- maximum threshold of documents a query term can appear to be
considered for correction -->
  <float name="maxQueryFrequency">0.01</float>
  <!-- uncomment this to require suggestions to occur in 1% of the documents
    <float name="thresholdTokenFrequency">.01</float>
  -->
</lst>

As you guess 'title' field is the one I'm searching & the one I'm building
my suggestions from.

@Ahmet Arsian: I understand that `spellcheck.q` doesnt resolve my issues,
cause I want to get suggestions only for current category.



2014-02-26 17:07 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:

> Hi Hakim,
>
> According to wiki spellcheck.q is intended to use with 'spelling ready'
> query/input.
> 'spelling ready' means it does not contain field names, AND, OR, etc.
> Something like should work. spellcheck.q=value1 value2&q=+field1:value1
> +field2:value2
>
> Ahmet
>
>
> On Wednesday, February 26, 2014 5:51 PM, Hakim Benoudjit <
> h.benoudjit@gmail.com> wrote:
> I have some difficulties to use `spellcheck.q` to get only suggestions for
> current query.
>
> When I set `spellcheck.q` to lucene query format (field1:value1 AND
> field2:value2), it doesnt return me any result.
>
> I have supposed that the value stored in `spellcheck.q` is just the value
> of ``spellcheck` component default field, but it returns an error in this
> case.
>
> Any help please?
>
>


Re: Format of the spellcheck.q used to get suggestions in current filter

Posted by Hakim Benoudjit <h....@gmail.com>.
@Jack Krupansky, here is the important portion of my solrconfig.xml:

<lst name="spellchecker">
  <str name="name">default</str>
  <str name="field">title</str>
  <str name="classname">solr.DirectSolrSpellChecker</str>
  <!-- the spellcheck distance measure used, the default is the internal
levenshtein -->
  <str name="distanceMeasure">internal</str>
  <!-- minimum accuracy needed to be considered a valid spellcheck
suggestion -->
  <float name="accuracy">0.5</float>
  <!-- the maximum #edits we consider when enumerating terms: can be 1 or 2
-->
  <int name="maxEdits">2</int>
  <!-- the minimum shared prefix when enumerating terms -->
  <int name="minPrefix">1</int>
  <!-- maximum number of inspections per result. -->
  <int name="maxInspections">5</int>
  <!-- minimum length of a query term to be considered for correction -->
  <int name="minQueryLength">4</int>
  <!-- maximum threshold of documents a query term can appear to be
considered for correction -->
  <float name="maxQueryFrequency">0.01</float>
  <!-- uncomment this to require suggestions to occur in 1% of the documents
    <float name="thresholdTokenFrequency">.01</float>
  -->
</lst>

As you guess 'title' field is the one I'm searching & the one I'm building
my suggestions from.

@Ahmet Arsian: I understand that `spellcheck.q` doesnt resolve my issues,
cause I want to get suggestions only for current category.


2014-02-26 17:07 GMT+01:00 Ahmet Arslan <io...@yahoo.com>:

> Hi Hakim,
>
> According to wiki spellcheck.q is intended to use with 'spelling ready'
> query/input.
> 'spelling ready' means it does not contain field names, AND, OR, etc.
> Something like should work. spellcheck.q=value1 value2&q=+field1:value1
> +field2:value2
>
> Ahmet
>
>
> On Wednesday, February 26, 2014 5:51 PM, Hakim Benoudjit <
> h.benoudjit@gmail.com> wrote:
> I have some difficulties to use `spellcheck.q` to get only suggestions for
> current query.
>
> When I set `spellcheck.q` to lucene query format (field1:value1 AND
> field2:value2), it doesnt return me any result.
>
> I have supposed that the value stored in `spellcheck.q` is just the value
> of ``spellcheck` component default field, but it returns an error in this
> case.
>
> Any help please?
>
>

Re: Format of the spellcheck.q used to get suggestions in current filter

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi Hakim,

According to wiki spellcheck.q is intended to use with 'spelling ready' query/input. 
'spelling ready' means it does not contain field names, AND, OR, etc.
Something like should work. spellcheck.q=value1 value2&q=+field1:value1 +field2:value2

Ahmet


On Wednesday, February 26, 2014 5:51 PM, Hakim Benoudjit <h....@gmail.com> wrote:
I have some difficulties to use `spellcheck.q` to get only suggestions for
current query.

When I set `spellcheck.q` to lucene query format (field1:value1 AND
field2:value2), it doesnt return me any result.

I have supposed that the value stored in `spellcheck.q` is just the value
of ``spellcheck` component default field, but it returns an error in this
case.

Any help please?